Skip to content

Commit

Permalink
Add undo/redo feature for wizard (datalens-tech#751)
Browse files Browse the repository at this point in the history
* CHARTS-9301: add redo/undo feature for wizard

* Fix icons

* Fix passing targetState fields by link

* Move history to global store

* Revert reset wizard store change, add reset history

* Move versioning to diffs

* Add feature flag

* Fix import

* Fix import

* Fix jest config

* Fix resetting edit history

* Fix ql tabs styles

* Fix diffs with functions

* Fix ignore path list

* PR fixes

* Fix compatibility between ql and wizard update

* Fix new state passing

* Fix colors dialog onApply

* Fix PR issues

* Fix dialog shapes

* Add correct qa attributes

* Add e2e tests

* Add titles

* Move jdp to utils

* Revert dialog changes

* Correct handle of addEditHistoryPoint

* Move keys

* Add skip for tests while not in production

* Translations update from Weblate Gravity for PR datalens-tech#751 (datalens-tech#801)

* Translated using Weblate (Russian)

Currently translated at 100.0% (7 of 7 strings)

Translation: DataLens/component.action-panel.view__751
Translate-URL: https://weblate.gravity-ui.com/projects/datalens/apanchuk-charts-9301-751/component-action-panel-view-751/ru/

* Translated using Weblate (English)

Currently translated at 100.0% (7 of 7 strings)

Translation: DataLens/component.action-panel.view__751
Translate-URL: https://weblate.gravity-ui.com/projects/datalens/apanchuk-charts-9301-751/component-action-panel-view-751/en/

---------

Co-authored-by: Darya Tikhonova <[email protected]>
Co-authored-by: Matthew Casserly <[email protected]>

* Fix old keys

---------

Co-authored-by: WeblateGravity <[email protected]>
Co-authored-by: Darya Tikhonova <[email protected]>
Co-authored-by: Matthew Casserly <[email protected]>
  • Loading branch information
4 people authored Mar 22, 2024
1 parent a19f1cd commit 681eb00
Show file tree
Hide file tree
Showing 30 changed files with 823 additions and 39 deletions.
1 change: 1 addition & 0 deletions jest/mappers/ignore-node-modules-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const IGNORE_NODE_MODULES_LIST = [
'dnd-core',
'monaco-editor',
'tinygesture',
'jsondiffpatch',
];

export const getIgnoredNodeModulesRegexp = () => {
Expand Down
38 changes: 38 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"js-sha1": "^0.6.0",
"js-yaml": "^4.1.0",
"json-fn": "^1.1.1",
"jsondiffpatch": "^0.6.0",
"jsonwebtoken": "^9.0.0",
"lodash": "^4.17.21",
"lru-cache": "^6.0.0",
Expand Down
7 changes: 4 additions & 3 deletions src/i18n-keysets/component.action-panel.view/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"button_open-navigation": "Open navigation",
"button_redo": "Restore",
"button_switch-public": "Public access",
"label_breadcrumb-new": "new {{scope}}",
"label_history-changes": "History changes",
"label_history-changes-date-limit": "You can view history for the past three months"
"button_undo": "Undo",
"label_history-changes": "Change history",
"label_history-changes-date-limit": "You can view the history for the past three months"
}
3 changes: 2 additions & 1 deletion src/i18n-keysets/component.action-panel.view/ru.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"button_open-navigation": "Открыть навигацию",
"button_redo": "Восстановить",
"button_switch-public": "Публичный доступ",
"label_breadcrumb-new": "new {{scope}}",
"button_undo": "Отменить",
"label_history-changes": "История изменений",
"label_history-changes-date-limit": "Доступна история за последние три месяца"
}
10 changes: 10 additions & 0 deletions src/server/components/features/features-list/EnableEditHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Feature} from '../../../../shared';
import {createFeatureConfig} from '../utils';

export default createFeatureConfig({
name: Feature.EnableEditHistory,
state: {
development: true,
production: false,
},
});
2 changes: 2 additions & 0 deletions src/shared/constants/qa/wizard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const enum WizardPageQa {
SectionPreview = 'preview-chartkit',
VisualizationSelectPopup = 'visualization-select-popup',
UndoButton = 'undo-btn',
RedoButton = 'redo-btn',
}

export const enum SectionDatasetQA {
Expand Down
1 change: 1 addition & 0 deletions src/shared/types/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export enum Feature {
EnableCustomMonitoring = 'EnableCustomMonitoring',
ShowActionPanelTreeSelect = 'ShowActionPanelTreeSelect',
EnableDashChartStat = 'EnableDashChartStat',
EnableEditHistory = 'EnableEditHistory',
EnableShareWidget = 'EnableShareWidget',
EnableAutocreateDataset = 'EnableAutocreateDataset',
ShowCreateEntryWithMenu = 'ShowCreateEntryWithMenu',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ export const ChartSaveControls: React.FC<ChartSaveControlProps> = (
...items,
];
}, [
isNewChart,
isLocked,
isCurrentRevisionActual,
onSaveAndPublishClick,
onSaveAsDraftClick,
onSaveAndPublishClick,
onSaveAsNewClick,
isNewChart,
]);

const allDropdownItems = React.useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ export type AdditionalButtonTemplate = {
hidden?: boolean;
loading?: boolean;
view?: ButtonView;
disabled?: boolean;
qa?: string;
title?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ export const useAdditionalItems = (args: UseAdditionalItemsArgs) => {
}
return (
<Button
disabled={itemProps.disabled || false}
qa={itemProps.qa}
key={itemProps.key}
className={itemProps.className}
view={itemProps.view || 'flat'}
size="m"
loading={itemProps.loading}
title={itemProps.title}
onClick={() => itemProps.action()}
>
{itemProps.icon && <Icon {...itemProps.icon} />}
Expand Down
2 changes: 2 additions & 0 deletions src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {QLState} from 'units/ql/store/typings';
import type {WizardGlobalState} from 'units/wizard/reducers';
import type {WorkbooksState} from 'units/workbooks/store/reducers';

import {EditHistoryState} from './store/reducers/editHistory';
import {CollectionsNavigationState} from './units/collections-navigation/store/reducers';

export {default as ActionPanel} from './components/ActionPanel/ActionPanel';
Expand Down Expand Up @@ -69,4 +70,5 @@ export type DatalensGlobalState = {
colorPaletteEditor: ColorPaletteEditorState;
migrationToWorkbook: MigrationToWorkbookState;
copyEntriesToWorkbook: CopyEntriesToWorkbookState;
editHistory: EditHistoryState;
};
Loading

0 comments on commit 681eb00

Please sign in to comment.