mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
feat: Init export requests modal
This commit is contained in:
parent
ede06c0274
commit
e1bdf662de
@ -0,0 +1,52 @@
|
||||
// @flow
|
||||
import React, { PureComponent } from 'react';
|
||||
import autobind from 'autobind-decorator';
|
||||
import Modal from '../base/modal';
|
||||
import ModalBody from '../base/modal-body';
|
||||
import ModalHeader from '../base/modal-header';
|
||||
import ModalFooter from '../base/modal-footer';
|
||||
|
||||
type Props = {};
|
||||
|
||||
@autobind
|
||||
class ExportRequestsModal extends PureComponent<Props> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
_setModalRef(n: React.Component<*> | null) {
|
||||
this.modal = n;
|
||||
}
|
||||
|
||||
show() {
|
||||
this.modal.show();
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.modal.hide();
|
||||
}
|
||||
|
||||
handleExport() {}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal ref={this._setModalRef} tall freshState {...this.props}>
|
||||
<ModalHeader>Export Requests</ModalHeader>
|
||||
<ModalBody />
|
||||
<ModalFooter>
|
||||
<div>
|
||||
<button className="btn" onClick={this.hide}>
|
||||
Cancel
|
||||
</button>
|
||||
<button className="btn" onClick={this.handleExport}>
|
||||
Export
|
||||
</button>
|
||||
</div>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ExportRequestsModal;
|
@ -43,6 +43,11 @@ class SettingsModal extends PureComponent {
|
||||
this.modal.hide();
|
||||
}
|
||||
|
||||
_handleExportRequests() {
|
||||
this.props.handleExportRequestsToFile();
|
||||
this.modal.hide();
|
||||
}
|
||||
|
||||
_handleExportWorkspace() {
|
||||
this.props.handleExportWorkspaceToFile();
|
||||
this.modal.hide();
|
||||
@ -128,6 +133,7 @@ class SettingsModal extends PureComponent {
|
||||
<TabPanel className="react-tabs__tab-panel pad scrollable">
|
||||
<ImportExport
|
||||
handleExportAll={this._handleExportAllToFile}
|
||||
handleExportRequests={this._handleExportRequests}
|
||||
handleExportWorkspace={this._handleExportWorkspace}
|
||||
handleImportFile={this._handleImportFile}
|
||||
handleImportUri={this._handleImportUri}
|
||||
@ -158,6 +164,7 @@ class SettingsModal extends PureComponent {
|
||||
SettingsModal.propTypes = {
|
||||
// Functions
|
||||
handleExportWorkspaceToFile: PropTypes.func.isRequired,
|
||||
handleExportRequestsToFile: PropTypes.func.isRequired,
|
||||
handleExportAllToFile: PropTypes.func.isRequired,
|
||||
handleImportFile: PropTypes.func.isRequired,
|
||||
handleImportUri: PropTypes.func.isRequired,
|
||||
|
@ -20,7 +20,12 @@ class ImportExport extends PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { handleImportFile, handleExportAll, handleExportWorkspace } = this.props;
|
||||
const {
|
||||
handleImportFile,
|
||||
handleExportAll,
|
||||
handleExportRequests,
|
||||
handleExportWorkspace,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
@ -45,6 +50,10 @@ class ImportExport extends PureComponent {
|
||||
<i className="fa fa-home" />
|
||||
Current Workspace
|
||||
</DropdownItem>
|
||||
<DropdownItem onClick={handleExportRequests}>
|
||||
<i className="fa fa-home" />
|
||||
Current Workspace's Requests
|
||||
</DropdownItem>
|
||||
<DropdownItem onClick={handleExportAll}>
|
||||
<i className="fa fa-empty" />
|
||||
All Workspaces
|
||||
@ -76,6 +85,7 @@ ImportExport.propTypes = {
|
||||
handleImportFile: PropTypes.func.isRequired,
|
||||
handleImportUri: PropTypes.func.isRequired,
|
||||
handleExportAll: PropTypes.func.isRequired,
|
||||
handleExportRequests: PropTypes.func.isRequired,
|
||||
handleExportWorkspace: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
|
@ -51,6 +51,7 @@ import type { Environment } from '../../models/environment';
|
||||
import ErrorBoundary from './error-boundary';
|
||||
import type { ClientCertificate } from '../../models/client-certificate';
|
||||
import MoveRequestGroupModal from './modals/move-request-group-modal';
|
||||
import ExportRequestsModal from './modals/export-requests-modal';
|
||||
|
||||
type Props = {
|
||||
// Helper Functions
|
||||
@ -60,6 +61,7 @@ type Props = {
|
||||
handleImportFileToWorkspace: Function,
|
||||
handleImportUriToWorkspace: Function,
|
||||
handleExportFile: Function,
|
||||
handleExportRequestsToFile: Function,
|
||||
handleSetActiveWorkspace: Function,
|
||||
handleSetActiveEnvironment: Function,
|
||||
handleMoveDoc: Function,
|
||||
@ -517,6 +519,7 @@ class Wrapper extends React.PureComponent<Props, State> {
|
||||
<SettingsModal
|
||||
ref={registerModal}
|
||||
handleExportWorkspaceToFile={this._handleExportWorkspaceToFile}
|
||||
handleExportRequestsToFile={this.props.handleExportRequestsToFile}
|
||||
handleExportAllToFile={handleExportFile}
|
||||
handleImportFile={this._handleImportFile}
|
||||
handleImportUri={this._handleImportUri}
|
||||
@ -564,6 +567,8 @@ class Wrapper extends React.PureComponent<Props, State> {
|
||||
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
||||
isVariableUncovered={isVariableUncovered}
|
||||
/>
|
||||
|
||||
<ExportRequestsModal ref={registerModal} />
|
||||
</ErrorBoundary>
|
||||
</div>,
|
||||
<div
|
||||
|
@ -67,6 +67,7 @@ import AskModal from '../components/modals/ask-modal';
|
||||
import { updateMimeType } from '../../models/request';
|
||||
import MoveRequestGroupModal from '../components/modals/move-request-group-modal';
|
||||
import * as themes from '../../plugins/misc';
|
||||
import ExportRequestsModal from '../components/modals/export-requests-modal';
|
||||
|
||||
@autobind
|
||||
class App extends PureComponent {
|
||||
@ -761,6 +762,10 @@ class App extends PureComponent {
|
||||
await this._handleSetSidebarHidden(sidebarHidden);
|
||||
}
|
||||
|
||||
_handleExportRequestsToFile() {
|
||||
showModal(ExportRequestsModal);
|
||||
}
|
||||
|
||||
_setWrapperRef(n) {
|
||||
this._wrapper = n;
|
||||
}
|
||||
@ -1014,6 +1019,7 @@ class App extends PureComponent {
|
||||
handleSetSidebarFilter={this._handleSetSidebarFilter}
|
||||
handleToggleMenuBar={this._handleToggleMenuBar}
|
||||
handleUpdateRequestMimeType={this._handleUpdateRequestMimeType}
|
||||
handleExportRequestsToFile={this._handleExportRequestsToFile}
|
||||
isVariableUncovered={this.state.isVariableUncovered}
|
||||
/>
|
||||
</ErrorBoundary>
|
||||
|
Loading…
Reference in New Issue
Block a user