insomnia/packages/insomnia-app/app/ui/components/wrapper.tsx

908 lines
34 KiB
TypeScript
Raw Normal View History

2018-06-25 17:42:50 +00:00
import type { Settings } from '../../models/settings';
import type { Response } from '../../models/response';
import type { OAuth2Token } from '../../models/o-auth-2-token';
import type { Workspace } from '../../models/workspace';
2020-04-26 20:33:39 +00:00
import type { WorkspaceMeta } from '../../models/workspace-meta';
2018-06-25 17:42:50 +00:00
import type {
Request,
RequestAuthentication,
RequestBody,
RequestHeader,
RequestParameter,
2018-06-25 17:42:50 +00:00
} from '../../models/request';
import type { SidebarChildObjects } from './sidebar/sidebar-children';
import React, { Fragment, PureComponent } from 'react';
import { autoBindMethodsForReact } from 'class-autobind-decorator';
import {
AUTOBIND_CFG,
ACTIVITY_DEBUG,
ACTIVITY_HOME,
ACTIVITY_SPEC,
ACTIVITY_UNIT_TEST,
getAppName,
SortOrder,
ACTIVITY_MIGRATION,
2021-02-25 20:13:37 +00:00
ACTIVITY_ONBOARDING,
ACTIVITY_ANALYTICS,
} from '../../common/constants';
2018-06-25 17:42:50 +00:00
import { registerModal, showModal } from './modals/index';
import AlertModal from './modals/alert-modal';
import WrapperModal from './modals/wrapper-modal';
2017-09-17 14:04:46 +00:00
import ErrorModal from './modals/error-modal';
import CookiesModal from './modals/cookies-modal';
2017-08-19 22:34:16 +00:00
import CookieModifyModal from '../components/modals/cookie-modify-modal';
import EnvironmentEditModal from './modals/environment-edit-modal';
import GenerateCodeModal from './modals/generate-code-modal';
import LoginModal from './modals/login-modal';
import ResponseDebugModal from './modals/response-debug-modal';
import PaymentNotificationModal from './modals/payment-notification-modal';
import NunjucksModal from './modals/nunjucks-modal';
import PromptModal from './modals/prompt-modal';
import AskModal from './modals/ask-modal';
2020-04-26 20:33:39 +00:00
import GenerateConfigModal from './modals/generate-config-modal';
2017-11-01 12:40:24 +00:00
import SelectModal from './modals/select-modal';
import RequestCreateModal from './modals/request-create-modal';
import RequestSwitcherModal from './modals/request-switcher-modal';
import SettingsModal from './modals/settings-modal';
import FilterHelpModal from './modals/filter-help-modal';
import RequestSettingsModal from './modals/request-settings-modal';
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
import SyncStagingModal from './modals/sync-staging-modal';
2020-04-26 20:33:39 +00:00
import GitRepositorySettingsModal from './modals/git-repository-settings-modal';
import GitStagingModal from './modals/git-staging-modal';
import GitBranchesModal from './modals/git-branches-modal';
import GitLogModal from './modals/git-log-modal';
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
import SyncMergeModal from './modals/sync-merge-modal';
import SyncHistoryModal from './modals/sync-history-modal';
import SyncShareModal from './modals/sync-share-modal';
import SyncBranchesModal from './modals/sync-branches-modal';
import SyncDeleteModal from './modals/sync-delete-modal';
import RequestRenderErrorModal from './modals/request-render-error-modal';
import WorkspaceEnvironmentsEditModal from './modals/workspace-environments-edit-modal';
import WorkspaceSettingsModal from './modals/workspace-settings-modal';
import CodePromptModal from './modals/code-prompt-modal';
import { database as db } from '../../common/database';
import * as models from '../../models/index';
2016-11-26 00:37:59 +00:00
import * as importers from 'insomnia-importers';
2018-06-25 17:42:50 +00:00
import type { CookieJar } from '../../models/cookie-jar';
import type { Environment } from '../../models/environment';
import ErrorBoundary from './error-boundary';
2018-06-25 17:42:50 +00:00
import type { ClientCertificate } from '../../models/client-certificate';
import MoveRequestGroupModal from './modals/move-request-group-modal';
import AddKeyCombinationModal from './modals/add-key-combination-modal';
2019-02-27 15:01:51 +00:00
import ExportRequestsModal from './modals/export-requests-modal';
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
import VCS from '../../sync/vcs';
import type { StatusCandidate } from '../../sync/types';
import type { RequestMeta } from '../../models/request-meta';
import type { RequestVersion } from '../../models/request-version';
2020-04-26 20:33:39 +00:00
import type { ApiSpec } from '../../models/api-spec';
import { GitVCS } from '../../sync/git/git-vcs';
2020-04-26 20:33:39 +00:00
import { trackPageView } from '../../common/analytics';
import type { GitRepository } from '../../models/git-repository';
import WrapperHome from './wrapper-home';
import WrapperDesign from './wrapper-design';
import WrapperUnitTest from './wrapper-unit-test';
2020-04-26 20:33:39 +00:00
import WrapperOnboarding from './wrapper-onboarding';
import WrapperDebug from './wrapper-debug';
import { importRaw } from '../../common/import';
import GitSyncDropdown from './dropdowns/git-sync-dropdown';
import { DropdownButton } from './base/dropdown';
import type { UnitTest } from '../../models/unit-test';
import type { UnitTestResult } from '../../models/unit-test-result';
import type { UnitTestSuite } from '../../models/unit-test-suite';
import type { GlobalActivity } from '../../common/constants';
import { Spectral } from '@stoplight/spectral';
import ProtoFilesModal from './modals/proto-files-modal';
import { GrpcDispatchModalWrapper } from '../context/grpc';
import WrapperMigration from './wrapper-migration';
import type { ImportOptions } from '../redux/modules/global';
import WrapperAnalytics from './wrapper-analytics';
import { HandleGetRenderContext, HandleRender } from '../../common/render';
import { RequestGroup } from '../../models/request-group';
const spectral = new Spectral();
2020-04-26 20:33:39 +00:00
export interface WrapperProps {
// Helper Functions
handleActivateRequest: (activeRequestId: string) => void;
handleSetSidebarFilter: (value: string) => Promise<void>;
handleToggleMenuBar: Function;
handleImportFileToWorkspace: (workspaceId: string, options?: ImportOptions) => void;
handleImportClipBoardToWorkspace: (workspaceId: string, options?: ImportOptions) => void;
handleImportUriToWorkspace: (workspaceId: string, uri: string, options?: ImportOptions) => void;
handleInitializeEntities: () => Promise<void>;
handleExportFile: Function;
handleShowExportRequestsModal: Function;
handleShowSettingsModal: Function;
handleExportRequestsToFile: Function;
handleSetActiveWorkspace: (workspaceId: string | null) => void;
handleSetActiveEnvironment: (environmentId: string | null) => Promise<void>;
handleMoveDoc: Function;
handleCreateRequest: (id: string) => any;
handleDuplicateRequest: Function;
handleDuplicateRequestGroup: (requestGroup: RequestGroup) => void;
handleMoveRequestGroup: (requestGroup: RequestGroup) => Promise<void>;
handleDuplicateWorkspace: Function;
handleCreateRequestGroup: (parentId: string) => void;
handleGenerateCodeForActiveRequest: Function;
handleGenerateCode: Function;
handleCopyAsCurl: Function;
handleCreateRequestForWorkspace: () => void;
handleSetRequestPaneRef: Function;
handleSetResponsePaneRef: Function;
handleSetResponsePreviewMode: Function;
handleRender: HandleRender;
handleGetRenderContext: HandleGetRenderContext;
handleSetResponseFilter: Function;
handleSetActiveResponse: Function;
handleSetSidebarRef: Function;
handleSidebarSort: (sortOrder: SortOrder) => void;
handleStartDragSidebar: React.MouseEventHandler;
handleResetDragSidebar: React.MouseEventHandler;
handleStartDragPaneHorizontal: React.MouseEventHandler;
handleStartDragPaneVertical: React.MouseEventHandler;
handleResetDragPaneHorizontal: React.MouseEventHandler;
handleResetDragPaneVertical: React.MouseEventHandler;
handleSetRequestGroupCollapsed: Function;
handleSetRequestPinned: Function;
handleSendRequestWithEnvironment: Function;
handleSendAndDownloadRequestWithEnvironment: Function;
handleUpdateRequestMimeType: (mimeType: string) => Promise<Request | null>;
handleUpdateDownloadPath: Function;
handleSetActiveActivity: (activity: GlobalActivity) => void;
handleGoToNextActivity: () => void;
// Properties
activity: GlobalActivity;
apiSpecs: ApiSpec[];
loadStartTime: number;
isLoading: boolean;
paneWidth: number;
paneHeight: number;
responsePreviewMode: string;
responseFilter: string;
responseFilterHistory: string[];
responseDownloadPath: string | null;
sidebarWidth: number;
sidebarHidden: boolean;
sidebarFilter: string;
sidebarChildren: SidebarChildObjects;
settings: Settings;
workspaces: Workspace[];
requestMetas: RequestMeta[];
requests: Request[];
requestVersions: RequestVersion[];
unseenWorkspaces: Workspace[];
workspaceChildren: (Request | RequestGroup)[];
activeWorkspaceMeta: WorkspaceMeta;
environments: Environment[];
activeApiSpec: ApiSpec;
activeUnitTestSuite: UnitTestSuite | null;
activeRequestResponses: Response[];
activeWorkspace: Workspace;
activeCookieJar: CookieJar;
activeEnvironment: Environment | null;
activeGitRepository: GitRepository | null;
activeUnitTestResult: UnitTestResult | null;
activeUnitTestSuites: UnitTestSuite[];
activeUnitTests: UnitTest[];
activeWorkspaceClientCertificates: ClientCertificate[];
headerEditorKey: string;
isVariableUncovered: boolean;
vcs: VCS | null;
gitVCS: GitVCS | null;
gitRepositories: GitRepository[];
syncItems: StatusCandidate[];
oAuth2Token?: OAuth2Token | null;
activeRequest?: Request | null;
activeResponse?: Response | null;
workspaceMetas?: WorkspaceMeta[];
}
export type HandleImportFileCallback = (options?: ImportOptions) => void;
export type HandleImportClipboardCallback = (options?: ImportOptions) => void;
export type HandleImportUriCallback = (uri: string, options?: ImportOptions) => void;
interface State {
forceRefreshKey: number;
activeGitBranch: string;
}
const rUpdate = (request, ...args: Partial<Request>[]) => {
2017-07-19 04:48:28 +00:00
if (!request) {
throw new Error('Tried to update null request');
}
// @ts-expect-error -- TSCONVERSION
2017-07-19 04:48:28 +00:00
return models.request.update(request, ...args);
};
2016-11-26 00:37:59 +00:00
const sUpdate = models.settings.update;
@autoBindMethodsForReact(AUTOBIND_CFG)
class Wrapper extends PureComponent<WrapperProps, State> {
state: State = {
forceRefreshKey: Date.now(),
activeGitBranch: 'no-vcs',
}
2016-11-26 00:37:59 +00:00
// Request updaters
async _handleForceUpdateRequest(r: Request, patch: Partial<Request>) {
const newRequest = await rUpdate(r, patch);
// Give it a second for the app to render first. If we don't wait, it will refresh
// on the old request and won't catch the newest one.
// TODO: Move this refresh key into redux store so we don't need timeout
window.setTimeout(this._forceRequestPaneRefresh, 100);
return newRequest;
}
_handleForceUpdateRequestHeaders(r: Request, headers: RequestHeader[]) {
return this._handleForceUpdateRequest(r, {
headers,
});
}
2016-11-28 07:12:17 +00:00
async _handleUpdateApiSpec(s: ApiSpec) {
2020-04-26 20:33:39 +00:00
await models.apiSpec.update(s);
}
static _handleUpdateRequestBody(r: Request, body: RequestBody) {
return rUpdate(r, {
body,
});
}
static _handleUpdateRequestParameters(r: Request, parameters: RequestParameter[]) {
return rUpdate(r, {
parameters,
});
}
static _handleUpdateRequestAuthentication(r: Request, authentication: RequestAuthentication) {
return rUpdate(r, {
authentication,
});
}
static _handleUpdateRequestHeaders(r: Request, headers: RequestHeader[]) {
return rUpdate(r, {
headers,
});
}
static _handleUpdateRequestMethod(r: Request, method: string) {
return rUpdate(r, {
method,
});
}
static _handleUpdateRequestUrl(r: Request, url: string) {
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
// Don't update if we don't need to
if (r.url === url) {
return Promise.resolve(r);
}
return rUpdate(r, {
url,
});
}
2016-11-26 00:37:59 +00:00
async _handleImport(text: string) {
2016-11-26 00:37:59 +00:00
// Allow user to paste any import file into the url. If it results in
// only one item, it will overwrite the current request.
try {
2018-06-25 17:42:50 +00:00
const { data } = await importers.convert(text);
const { resources } = data;
2016-11-26 00:37:59 +00:00
const r = resources[0];
if (r && r._type === 'request' && this.props.activeRequest) {
2016-11-26 00:37:59 +00:00
// Only pull fields that we want to update
return this._handleForceUpdateRequest(this.props.activeRequest, {
2016-11-26 00:37:59 +00:00
url: r.url,
method: r.method,
headers: r.headers,
// @ts-expect-error -- TSCONVERSION
2016-11-26 00:37:59 +00:00
body: r.body,
authentication: r.authentication,
// @ts-expect-error -- TSCONVERSION
parameters: r.parameters,
2016-11-26 00:37:59 +00:00
});
}
} catch (e) {
// Import failed, that's alright
}
return null;
}
async _handleWorkspaceActivityChange(workspaceId: string, nextActivity: GlobalActivity) {
const { activity, activeApiSpec, handleSetActiveActivity } = this.props;
2020-04-26 20:33:39 +00:00
// Remember last activity on workspace for later, but only if it isn't HOME
if (nextActivity !== ACTIVITY_HOME) {
await models.workspaceMeta.updateByParentId(workspaceId, {
activeActivity: nextActivity,
});
}
const notEditingASpec = activity !== ACTIVITY_SPEC;
if (notEditingASpec) {
handleSetActiveActivity(nextActivity);
return;
}
2020-04-26 20:33:39 +00:00
// Handle switching away from the spec design activity. For this, we want to generate
// requests that can be accessed from debug or test.
// If there are errors in the spec, show the user a warning first
const results = await spectral.run(activeApiSpec.contents);
if (activeApiSpec.contents && results && results.length) {
showModal(AlertModal, {
title: 'Error Generating Configuration',
message:
'Some requests may not be available due to errors found in the ' +
'specification. We recommend fixing errors before proceeding. 🤗',
okLabel: 'Proceed',
addCancel: true,
onConfirm: () => {
handleSetActiveActivity(nextActivity);
},
});
return;
}
// Delaying generation so design to debug mode is smooth
handleSetActiveActivity(nextActivity);
2020-04-26 20:33:39 +00:00
setTimeout(() => {
importRaw(activeApiSpec.contents, {
getWorkspaceId: () => Promise.resolve(workspaceId),
Differential (Additive/Removal) patching when switching between design / debug (#3124) * fix(import) do differential patching for design activity imports This patch adds differential patching for imports that occur during the switching between design and debug tabs inside of Designer. As reported through #2971, and others, this patch favors existing data over imported data, values that exist already on the document will remain unchanged, only new values (including array based values) will be added / removed. This also includes a bypass feature for urls, currently these options are not exposed through the interface but could be. This feature is an object to allow for future properties for preference-based patching. - Adds `options.enableDiffBasedPatching` and `options.enableDiffDeep` to `importRaw` for backwards compat. - Adds `options.bypassDiffProps.url` for url bypassing and use an object for future items. - Adds `diffPatchObj` based on differential patching for objects (works with arrays as well). Future ideas: - `hasBeenModifiedByUser` property map object to allow changing properties that haven't been touched by the user with options. fixes: #2971, #2882, #3038, #2442 * adds some basic tests - also adds jest (which was (mistakenly) not there before) - does not call `.hasOwnProperty` directly, per https://eslint.org/docs/rules/no-prototype-builtins (which, we will add more formally at a later date) * don't special-case workspaces this ensures the behavior of the initial PR is more preserved Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
2021-03-03 17:57:09 +00:00
enableDiffBasedPatching: true,
enableDiffDeep: true,
bypassDiffProps: {
url: true,
},
});
2020-04-26 20:33:39 +00:00
}, 1000);
}
2016-11-26 00:37:59 +00:00
// Settings updaters
_handleUpdateSettingsShowPasswords(showPasswords: boolean) {
return sUpdate(this.props.settings, {
showPasswords,
});
}
_handleUpdateSettingsUseBulkHeaderEditor(useBulkHeaderEditor: boolean) {
return sUpdate(this.props.settings, {
useBulkHeaderEditor,
});
}
2016-11-26 00:37:59 +00:00
_handleUpdateSettingsUseBulkParametersEditor(useBulkParametersEditor: boolean) {
return sUpdate(this.props.settings, {
useBulkParametersEditor,
});
2020-08-03 10:13:08 +00:00
}
_handleImportFile(options?: ImportOptions) {
this.props.handleImportFileToWorkspace(this.props.activeWorkspace._id, options);
2020-04-26 20:33:39 +00:00
}
_handleImportUri(uri: string, options?: ImportOptions) {
this.props.handleImportUriToWorkspace(this.props.activeWorkspace._id, uri, options);
}
_handleImportClipBoard(options?: ImportOptions) {
this.props.handleImportClipBoardToWorkspace(this.props.activeWorkspace._id, options);
}
_handleSetActiveResponse(responseId: string | null) {
2017-07-19 04:48:28 +00:00
if (!this.props.activeRequest) {
console.warn('Tried to set active response when request not active');
return;
}
2018-10-17 16:42:33 +00:00
this.props.handleSetActiveResponse(this.props.activeRequest._id, responseId);
}
2016-12-07 17:57:01 +00:00
_handleShowEnvironmentsModal() {
showModal(WorkspaceEnvironmentsEditModal, this.props.activeWorkspace);
}
2016-11-26 00:37:59 +00:00
_handleShowCookiesModal() {
showModal(CookiesModal, this.props.activeWorkspace);
}
static _handleShowModifyCookieModal(cookie: Record<string, any>) {
2017-08-22 22:30:57 +00:00
showModal(CookieModifyModal, cookie);
2017-08-19 22:34:16 +00:00
}
_handleShowRequestSettingsModal() {
showModal(RequestSettingsModal, {
request: this.props.activeRequest,
});
}
async _handleDeleteResponses(requestId: string, environmentId: string | null) {
const { handleSetActiveResponse, activeRequest } = this.props;
await models.response.removeForRequest(requestId, environmentId);
if (activeRequest && activeRequest._id === requestId) {
await handleSetActiveResponse(requestId, null);
}
}
async _handleDeleteResponse(response: Response) {
2017-06-12 21:48:17 +00:00
if (response) {
await models.response.remove(response);
}
// Also unset active response it's the one we're deleting
2018-10-17 16:42:33 +00:00
if (this.props.activeResponse && this.props.activeResponse._id === response._id) {
2017-06-12 21:48:17 +00:00
this._handleSetActiveResponse(null);
}
}
async _handleRemoveActiveWorkspace() {
2018-06-25 17:42:50 +00:00
const { workspaces, activeWorkspace } = this.props;
if (workspaces.length <= 1) {
showModal(AlertModal, {
title: 'Deleting Last Workspace',
message: 'Since you deleted your only workspace, a new one has been created for you.',
onConfirm: async () => {
await models.stats.incrementDeletedRequestsForDescendents(activeWorkspace);
await models.workspace.create({
name: getAppName(),
});
await models.workspace.remove(activeWorkspace);
},
});
} else {
await models.stats.incrementDeletedRequestsForDescendents(activeWorkspace);
await models.workspace.remove(activeWorkspace);
}
}
async _handleActiveWorkspaceClearAllResponses() {
const docs = await db.withDescendants(this.props.activeWorkspace, models.request.type);
const requests = docs.filter(doc => doc.type === models.request.type);
for (const req of requests) {
await models.response.removeForRequest(req._id);
}
}
_handleSendRequestWithActiveEnvironment() {
2018-10-17 16:42:33 +00:00
const { activeRequest, activeEnvironment, handleSendRequestWithEnvironment } = this.props;
2016-11-26 00:37:59 +00:00
const activeRequestId = activeRequest ? activeRequest._id : 'n/a';
2018-10-17 16:42:33 +00:00
const activeEnvironmentId = activeEnvironment ? activeEnvironment._id : 'n/a';
2016-11-26 00:37:59 +00:00
handleSendRequestWithEnvironment(activeRequestId, activeEnvironmentId);
}
2016-11-25 23:09:17 +00:00
async _handleSendAndDownloadRequestWithActiveEnvironment(filename?: string) {
2018-06-25 17:42:50 +00:00
const {
activeRequest,
activeEnvironment,
handleSendAndDownloadRequestWithEnvironment,
2018-06-25 17:42:50 +00:00
} = this.props;
const activeRequestId = activeRequest ? activeRequest._id : 'n/a';
2018-10-17 16:42:33 +00:00
const activeEnvironmentId = activeEnvironment ? activeEnvironment._id : 'n/a';
await handleSendAndDownloadRequestWithEnvironment(
activeRequestId,
activeEnvironmentId,
filename,
);
}
_handleSetPreviewMode(previewMode: string) {
2016-11-25 23:09:17 +00:00
const activeRequest = this.props.activeRequest;
const activeRequestId = activeRequest ? activeRequest._id : 'n/a';
this.props.handleSetResponsePreviewMode(activeRequestId, previewMode);
}
2016-11-25 23:09:17 +00:00
_handleSetResponseFilter(filter: string) {
2016-11-25 23:09:17 +00:00
const activeRequest = this.props.activeRequest;
const activeRequestId = activeRequest ? activeRequest._id : 'n/a';
this.props.handleSetResponseFilter(activeRequestId, filter);
}
2016-11-25 23:09:17 +00:00
_handleCreateRequestInWorkspace() {
const { activeWorkspace, handleCreateRequest } = this.props;
handleCreateRequest(activeWorkspace._id);
}
_handleCreateRequestGroupInWorkspace() {
const { activeWorkspace, handleCreateRequestGroup } = this.props;
handleCreateRequestGroup(activeWorkspace._id);
}
_handleChangeEnvironment(id: string | null) {
const { handleSetActiveEnvironment } = this.props;
handleSetActiveEnvironment(id);
}
_forceRequestPaneRefresh() {
this.setState({
forceRefreshKey: Date.now(),
});
}
2016-11-25 23:09:17 +00:00
_handleGitBranchChanged(branch) {
this.setState({
activeGitBranch: branch || 'no-vcs',
});
}
2020-04-26 20:33:39 +00:00
componentDidMount() {
const { activity } = this.props;
trackPageView(`/${activity || ''}`);
}
componentDidUpdate(prevProps: WrapperProps) {
2020-04-26 20:33:39 +00:00
// We're using activities as page views so here we monitor
// for a change in activity and send it as a pageview.
const { activity } = this.props;
2020-04-26 20:33:39 +00:00
if (prevProps.activity !== activity) {
trackPageView(`/${activity || ''}`);
}
}
render() {
const {
activeCookieJar,
activeEnvironment,
2020-04-26 20:33:39 +00:00
activeGitRepository,
activeRequest,
activeWorkspace,
activeApiSpec,
activeWorkspaceClientCertificates,
2020-04-26 20:33:39 +00:00
activity,
gitVCS,
handleActivateRequest,
handleDuplicateWorkspace,
2016-11-25 23:09:17 +00:00
handleExportFile,
handleExportRequestsToFile,
handleGetRenderContext,
2020-04-26 20:33:39 +00:00
handleInitializeEntities,
handleRender,
handleSetActiveWorkspace,
handleShowExportRequestsModal,
handleSidebarSort,
handleToggleMenuBar,
isVariableUncovered,
requestMetas,
settings,
2016-11-25 23:09:17 +00:00
sidebarChildren,
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
syncItems,
vcs,
workspaceChildren,
workspaces,
2016-11-25 23:09:17 +00:00
} = this.props;
2020-04-26 20:33:39 +00:00
// Setup git sync dropdown for use in Design/Debug pages
let gitSyncDropdown: JSX.Element | null = null;
2020-04-26 20:33:39 +00:00
if (gitVCS) {
gitSyncDropdown = (
<GitSyncDropdown
className="margin-left"
workspace={activeWorkspace}
// @ts-expect-error -- TSCONVERSION this prop is unused
2020-04-26 20:33:39 +00:00
dropdownButtonClassName="btn--clicky-small btn-sync btn-utility"
gitRepository={activeGitRepository}
vcs={gitVCS}
handleInitializeEntities={handleInitializeEntities}
handleGitBranchChanged={this._handleGitBranchChanged}
2020-04-26 20:33:39 +00:00
renderDropdownButton={children => (
<DropdownButton className="btn--clicky-small btn-sync btn-utility">
{children}
</DropdownButton>
)}
/>
);
}
2020-04-26 20:33:39 +00:00
return (
<Fragment>
2020-04-26 20:33:39 +00:00
<div key="modals" className="modals">
<ErrorBoundary showAlert>
<AlertModal ref={registerModal} />
<ErrorModal ref={registerModal} />
<PromptModal ref={registerModal} />
<WrapperModal ref={registerModal} />
<LoginModal ref={registerModal} />
<AskModal ref={registerModal} />
<SelectModal ref={registerModal} />
<RequestCreateModal ref={registerModal} />
<PaymentNotificationModal ref={registerModal} />
<FilterHelpModal ref={registerModal} />
<RequestRenderErrorModal ref={registerModal} />
<GenerateConfigModal ref={registerModal} settings={settings} />
<CodePromptModal
ref={registerModal}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
editorKeyMap={settings.editorKeyMap}
editorLineWrapping={settings.editorLineWrapping}
isVariableUncovered={isVariableUncovered}
/>
<RequestSettingsModal
ref={registerModal}
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
editorKeyMap={settings.editorKeyMap}
editorLineWrapping={settings.editorLineWrapping}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
workspaces={workspaces}
isVariableUncovered={isVariableUncovered}
/>
{/* TODO: Figure out why cookieJar is sometimes null */}
{activeCookieJar ? (
<CookiesModal
handleShowModifyCookieModal={Wrapper._handleShowModifyCookieModal}
handleRender={handleRender}
ref={registerModal}
workspace={activeWorkspace}
cookieJar={activeCookieJar}
/>
) : null}
2020-04-26 20:33:39 +00:00
<CookieModifyModal
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
handleRender={handleRender}
2020-04-26 20:33:39 +00:00
handleGetRenderContext={handleGetRenderContext}
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
ref={registerModal}
cookieJar={activeCookieJar}
2020-04-26 20:33:39 +00:00
workspace={activeWorkspace}
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
isVariableUncovered={isVariableUncovered}
/>
2017-08-23 03:33:07 +00:00
2020-04-26 20:33:39 +00:00
<NunjucksModal
uniqueKey={`key::${this.state.forceRefreshKey}`}
ref={registerModal}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
workspace={activeWorkspace}
/>
<MoveRequestGroupModal
ref={registerModal}
workspaces={workspaces}
activeWorkspace={activeWorkspace}
/>
2020-04-26 20:33:39 +00:00
<WorkspaceSettingsModal
ref={registerModal}
clientCertificates={activeWorkspaceClientCertificates}
workspace={activeWorkspace}
apiSpec={activeApiSpec}
2020-04-26 20:33:39 +00:00
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
editorKeyMap={settings.editorKeyMap}
editorLineWrapping={settings.editorLineWrapping}
handleRender={handleRender}
handleGetRenderContext={handleGetRenderContext}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
handleRemoveWorkspace={this._handleRemoveActiveWorkspace}
handleDuplicateWorkspace={handleDuplicateWorkspace}
handleClearAllResponses={this._handleActiveWorkspaceClearAllResponses}
isVariableUncovered={isVariableUncovered}
/>
2020-04-26 20:33:39 +00:00
<GenerateCodeModal
ref={registerModal}
environmentId={activeEnvironment ? activeEnvironment._id : 'n/a'}
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
editorKeyMap={settings.editorKeyMap}
/>
2020-04-26 20:33:39 +00:00
<SettingsModal
ref={registerModal}
handleShowExportRequestsModal={handleShowExportRequestsModal}
handleExportAllToFile={handleExportFile}
handleImportClipBoard={this._handleImportClipBoard}
handleImportFile={this._handleImportFile}
handleImportUri={this._handleImportUri}
handleToggleMenuBar={handleToggleMenuBar}
settings={settings}
/>
2020-04-26 20:33:39 +00:00
<ResponseDebugModal ref={registerModal} settings={settings} />
2020-04-26 20:33:39 +00:00
<RequestSwitcherModal
ref={registerModal}
workspace={activeWorkspace}
workspaces={workspaces}
workspaceChildren={workspaceChildren}
activeRequest={activeRequest}
activateRequest={handleActivateRequest}
requestMetas={requestMetas}
handleSetActiveWorkspace={handleSetActiveWorkspace}
/>
2020-04-26 20:33:39 +00:00
<EnvironmentEditModal
ref={registerModal}
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
editorKeyMap={settings.editorKeyMap}
lineWrapping={settings.editorLineWrapping}
onChange={models.requestGroup.update}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
Version Control (beta) (#1439) * VCS proof of concept underway! * Stuff * Some things * Replace deprecated Electron makeSingleInstance * Rename `window` variables so not to be confused with window object * Don't unnecessarily update request when URL does not change * Regenerate package-lock * Fix tests + ESLint * Publish - insomnia-app@1.0.49 - insomnia-cookies@0.0.12 - insomnia-httpsnippet@1.16.18 - insomnia-importers@2.0.13 - insomnia-libcurl@0.0.23 - insomnia-prettify@0.1.7 - insomnia-url@0.1.6 - insomnia-xpath@1.0.9 - insomnia-plugin-base64@1.0.6 - insomnia-plugin-cookie-jar@1.0.8 - insomnia-plugin-core-themes@1.0.5 - insomnia-plugin-default-headers@1.1.9 - insomnia-plugin-file@1.0.7 - insomnia-plugin-hash@1.0.7 - insomnia-plugin-jsonpath@1.0.12 - insomnia-plugin-now@1.0.11 - insomnia-plugin-os@1.0.13 - insomnia-plugin-prompt@1.1.9 - insomnia-plugin-request@1.0.18 - insomnia-plugin-response@1.0.16 - insomnia-plugin-uuid@1.0.10 * Broken but w/e * Some tweaks * Big refactor. Create local snapshots and push done * POC merging and a lot of improvements * Lots of work done on initial UI/UX * Fix old tests * Atomic writes and size-based batches * Update StageEntry definition once again to be better * Factor out GraphQL query logic * Merge algorithm, history modal, other minor things * Fix test * Merge, checkout, revert w/ user changes now work * Force UI to refresh when switching branches changes active request * Rough draft pull() and some cleanup * E2EE stuff and some refactoring * Add ability to share project with team and fixed tests * VCS now created in root component and better remote project handling * Remove unused definition * Publish - insomnia-account@0.0.2 - insomnia-app@1.1.1 - insomnia-cookies@0.0.14 - insomnia-httpsnippet@1.16.20 - insomnia-importers@2.0.15 - insomnia-libcurl@0.0.25 - insomnia-prettify@0.1.9 - insomnia-sync@0.0.2 - insomnia-url@0.1.8 - insomnia-xpath@1.0.11 - insomnia-plugin-base64@1.0.8 - insomnia-plugin-cookie-jar@1.0.10 - insomnia-plugin-core-themes@1.0.7 - insomnia-plugin-file@1.0.9 - insomnia-plugin-hash@1.0.9 - insomnia-plugin-jsonpath@1.0.14 - insomnia-plugin-now@1.0.13 - insomnia-plugin-os@1.0.15 - insomnia-plugin-prompt@1.1.11 - insomnia-plugin-request@1.0.20 - insomnia-plugin-response@1.0.18 - insomnia-plugin-uuid@1.0.12 * Move some deps around * Fix Flow errors * Update package.json * Fix eslint errors * Fix tests * Update deps * bootstrap insomnia-sync * TRy fixing appveyor * Try something else * Bump lerna * try powershell * Try again * Fix imports * Fixed errors * sync types refactor * Show remote projects in workspace dropdown * Improved pulling of non-local workspaces * Loading indicators and some tweaks * Clean up sync staging modal * Some sync improvements: - No longer store stage - Upgrade Electron - Sync UI/UX improvements * Fix snyc tests * Upgraded deps and hot loader tweaks (it's broken for some reason) * Fix tests * Branches dialog, network refactoring, some tweaks * Fixed merging when other branch is empty * A bunch of small fixes from real testing * Fixed pull merge logic * Fix tests * Some bug fixes * A few small tweaks * Conflict resolution and other improvements * Fix tests * Add revert changes * Deal with duplicate projects per workspace * Some tweaks and accessibility improvements * Tooltip accessibility * Fix API endpoint * Fix tests * Remove jest dep from insomnia-importers
2019-04-18 00:50:03 +00:00
2020-04-26 20:33:39 +00:00
{gitVCS && (
<Fragment>
2020-04-26 20:33:39 +00:00
<GitStagingModal ref={registerModal} workspace={activeWorkspace} vcs={gitVCS} />
<GitLogModal ref={registerModal} vcs={gitVCS} />
<GitRepositorySettingsModal ref={registerModal} />
{activeGitRepository !== null && (
<GitBranchesModal
ref={registerModal}
vcs={gitVCS}
gitRepository={activeGitRepository}
handleInitializeEntities={handleInitializeEntities}
handleGitBranchChanged={this._handleGitBranchChanged}
2020-04-26 20:33:39 +00:00
/>
)}
</Fragment>
2020-04-26 20:33:39 +00:00
)}
{vcs && (
<Fragment>
2020-04-26 20:33:39 +00:00
<SyncStagingModal
ref={registerModal}
workspace={activeWorkspace}
vcs={vcs}
syncItems={syncItems}
/>
<SyncMergeModal
ref={registerModal}
workspace={activeWorkspace}
syncItems={syncItems}
vcs={vcs}
/>
<SyncBranchesModal
ref={registerModal}
workspace={activeWorkspace}
vcs={vcs}
syncItems={syncItems}
/>
<SyncDeleteModal ref={registerModal} workspace={activeWorkspace} vcs={vcs} />
2020-04-26 20:33:39 +00:00
<SyncHistoryModal ref={registerModal} workspace={activeWorkspace} vcs={vcs} />
<SyncShareModal ref={registerModal} workspace={activeWorkspace} vcs={vcs} />
</Fragment>
2020-04-26 20:33:39 +00:00
)}
<WorkspaceEnvironmentsEditModal
ref={registerModal}
handleChangeEnvironment={this._handleChangeEnvironment}
2020-04-26 20:33:39 +00:00
lineWrapping={settings.editorLineWrapping}
editorFontSize={settings.editorFontSize}
editorIndentSize={settings.editorIndentSize}
editorKeyMap={settings.editorKeyMap}
activeEnvironmentId={activeEnvironment ? activeEnvironment._id : null}
render={handleRender}
getRenderContext={handleGetRenderContext}
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
isVariableUncovered={isVariableUncovered}
/>
2020-04-26 20:33:39 +00:00
<AddKeyCombinationModal ref={registerModal} />
<ExportRequestsModal
ref={registerModal}
childObjects={sidebarChildren.all}
handleExportRequestsToFile={handleExportRequestsToFile}
/>
<GrpcDispatchModalWrapper>
{dispatch => (
<ProtoFilesModal
ref={registerModal}
grpcDispatch={dispatch}
workspace={activeWorkspace}
/>
)}
</GrpcDispatchModalWrapper>
2020-04-26 20:33:39 +00:00
</ErrorBoundary>
</div>
<Fragment key={`views::${this.state.activeGitBranch}`}>
{activity === ACTIVITY_HOME && (
<WrapperHome
wrapperProps={this.props}
handleImportFile={this._handleImportFile}
handleImportUri={this._handleImportUri}
handleImportClipboard={this._handleImportClipBoard}
/>
)}
{activity === ACTIVITY_SPEC && (
<WrapperDesign
gitSyncDropdown={gitSyncDropdown}
handleActivityChange={this._handleWorkspaceActivityChange}
handleUpdateApiSpec={this._handleUpdateApiSpec}
wrapperProps={this.props}
/>
)}
{activity === ACTIVITY_UNIT_TEST && (
<WrapperUnitTest
gitSyncDropdown={gitSyncDropdown}
wrapperProps={this.props}
handleActivityChange={this._handleWorkspaceActivityChange}
children={sidebarChildren}
/>
)}
{activity === ACTIVITY_DEBUG && (
<WrapperDebug
forceRefreshKey={this.state.forceRefreshKey}
gitSyncDropdown={gitSyncDropdown}
handleActivityChange={this._handleWorkspaceActivityChange}
handleChangeEnvironment={this._handleChangeEnvironment}
handleDeleteResponse={this._handleDeleteResponse}
handleDeleteResponses={this._handleDeleteResponses}
handleForceUpdateRequest={this._handleForceUpdateRequest}
handleForceUpdateRequestHeaders={this._handleForceUpdateRequestHeaders}
handleImport={this._handleImport}
handleImportFile={this._handleImportFile}
handleRequestCreate={this._handleCreateRequestInWorkspace}
handleRequestGroupCreate={this._handleCreateRequestGroupInWorkspace}
handleSendAndDownloadRequestWithActiveEnvironment={
this._handleSendAndDownloadRequestWithActiveEnvironment
}
handleSendRequestWithActiveEnvironment={this._handleSendRequestWithActiveEnvironment}
handleSetActiveResponse={this._handleSetActiveResponse}
handleSetPreviewMode={this._handleSetPreviewMode}
handleSetResponseFilter={this._handleSetResponseFilter}
handleShowCookiesModal={this._handleShowCookiesModal}
handleShowRequestSettingsModal={this._handleShowRequestSettingsModal}
handleSidebarSort={handleSidebarSort}
handleUpdateRequestAuthentication={Wrapper._handleUpdateRequestAuthentication}
handleUpdateRequestBody={Wrapper._handleUpdateRequestBody}
handleUpdateRequestHeaders={Wrapper._handleUpdateRequestHeaders}
handleUpdateRequestMethod={Wrapper._handleUpdateRequestMethod}
handleUpdateRequestParameters={Wrapper._handleUpdateRequestParameters}
handleUpdateRequestUrl={Wrapper._handleUpdateRequestUrl}
handleUpdateSettingsShowPasswords={this._handleUpdateSettingsShowPasswords}
handleUpdateSettingsUseBulkHeaderEditor={
this._handleUpdateSettingsUseBulkHeaderEditor
}
2020-08-03 10:13:08 +00:00
handleUpdateSettingsUseBulkParametersEditor={
this._handleUpdateSettingsUseBulkParametersEditor
}
wrapperProps={this.props}
/>
)}
{activity === ACTIVITY_MIGRATION && <WrapperMigration wrapperProps={this.props} />}
{activity === ACTIVITY_ANALYTICS && <WrapperAnalytics wrapperProps={this.props} />}
2021-02-25 20:13:37 +00:00
{(activity === ACTIVITY_ONBOARDING || activity === null) && (
<WrapperOnboarding
wrapperProps={this.props}
handleImportFile={this._handleImportFile}
handleImportUri={this._handleImportUri}
/>
)}
</Fragment>
</Fragment>
2020-04-26 20:33:39 +00:00
);
2016-11-25 23:09:17 +00:00
}
}
export default Wrapper;