import * as React from 'react';
import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
import HelpBlock from '../../components/HelpBlock';
import { LoadButton } from './components/LoadButton';
import { ClearButton } from './components/ClearButton';
import { ExportDropdown } from './components/ExportDropdown';
import Panel from '../../components/Panel';
export const StateManagementPopup = (props) => {
    const baseClassName = 'ab-ManageState';
    return (React.createElement(PopupPanel, { className: baseClassName, headerText: props.moduleInfo.FriendlyName, glyphicon: props.moduleInfo.Glyph, infoLink: props.moduleInfo.HelpPage, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
        React.createElement(Panel, { className: `${baseClassName}__panel twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "user-state", header: 'User State', variant: "default" },
            React.createElement(HelpBlock, { className: "twa:mb-2" }, 'Clear all current user state that has been persisted'),
            React.createElement(HelpBlock, { style: { color: 'var(--ab-color-warn)' } }, 'This will cause this window to close and any State you have previously created will be lost, and the Initial Adaptable State will be reapplied'),
            React.createElement(ClearButton, { "data-name": "clear-user-state-button", tone: "info", variant: "raised", className: "twa:mt-2", accessLevel: props.accessLevel, onClick: () => props.api.stateApi.reloadInitialState() }, "Clear User State")),
        React.createElement(Panel, { className: `${baseClassName}__panel twa:mt-3 twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "initial-state", header: 'Initial Adaptable State', variant: "default" },
            React.createElement(HelpBlock, { className: "twa:mt-2" }, 'Load Initial Adaptable State (from a .json file) - this will cause this window to close'),
            ' ',
            React.createElement(LoadButton, { tone: "info", variant: "raised", className: "twa:mt-2", accessLevel: props.accessLevel, onLoad: (json) => props.api.stateApi.reloadInitialState(json), "data-name": "load-initial-state-button" }, "Load Initial Adaptable State")),
        React.createElement(Panel, { className: `${baseClassName}__panel twa:mt-3 twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "adaptable-state", header: 'Export Adaptable State' },
            React.createElement(HelpBlock, { className: "twa:my-2" }, 'Exports the currently persisted Adaptable State'),
            ' ',
            React.createElement(ExportDropdown, { api: props.api, type: "adaptableState", className: "twa:mr-3 twa:flex-1 twa:max-w-none", columns: ['label'], "data-name": "export-adaptable-state-dropdown" }, "Select Export Destination")),
        React.createElement(Panel, { className: `${baseClassName}__panel twa:mt-3 twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "initial-state", header: 'Export Initial Adaptable State', variant: "default" },
            React.createElement(HelpBlock, { className: "twa:my-2" }, 'Exports the Initial Adaptable State which was provided at design time'),
            ' ',
            React.createElement(ExportDropdown, { api: props.api, type: "initialState", className: "twa:mr-3 twa:flex-1 twa:max-w-none", columns: ['label'], "data-name": "export-initial-state-dropdown" }, "Select Export Destination"))));
};
