mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
hotfix - INS-782
This commit is contained in:
parent
c2c41f3d84
commit
ef840cd516
@ -43,6 +43,7 @@ import { Settings } from '../../../models/settings';
|
||||
import { GrpcRequest } from '../../../models/grpc-request';
|
||||
import { Request } from '../../../models/request';
|
||||
import { Environment } from '../../../models/environment';
|
||||
import { unreachableCase } from 'ts-assert-unreachable';
|
||||
|
||||
export const LOCALSTORAGE_PREFIX = 'insomnia::meta';
|
||||
const LOGIN_STATE_CHANGE = 'global/login-state-change';
|
||||
@ -489,24 +490,27 @@ export const importUri = (
|
||||
};
|
||||
|
||||
function showSelectExportTypeModal(onCancel: () => void, onDone: (selectedFormat: SelectedFormat) => void) {
|
||||
const options = [
|
||||
{
|
||||
name: 'Insomnia v4 (JSON)',
|
||||
value: VALUE_JSON,
|
||||
},
|
||||
{
|
||||
name: 'Insomnia v4 (YAML)',
|
||||
value: VALUE_YAML,
|
||||
},
|
||||
{
|
||||
name: 'HAR – HTTP Archive Format',
|
||||
value: VALUE_HAR,
|
||||
},
|
||||
];
|
||||
const lastFormat = window.localStorage.getItem('insomnia.lastExportFormat');
|
||||
const defaultValue = options.map(({ value }) => value).includes(lastFormat) ? lastFormat : VALUE_JSON;
|
||||
|
||||
showModal(SelectModal, {
|
||||
title: 'Select Export Type',
|
||||
value: lastFormat,
|
||||
options: [
|
||||
{
|
||||
name: 'Insomnia v4 (JSON)',
|
||||
value: VALUE_JSON,
|
||||
},
|
||||
{
|
||||
name: 'Insomnia v4 (YAML)',
|
||||
value: VALUE_YAML,
|
||||
},
|
||||
{
|
||||
name: 'HAR – HTTP Archive Format',
|
||||
value: VALUE_HAR,
|
||||
},
|
||||
],
|
||||
value: defaultValue,
|
||||
options,
|
||||
message: 'Which format would you like to export as?',
|
||||
onCancel,
|
||||
onDone: (selectedFormat: SelectedFormat) => {
|
||||
@ -599,6 +603,9 @@ export const exportWorkspacesToFile = (workspaceId: string | undefined = undefin
|
||||
'json',
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachableCase(`selected export format "${selectedFormat}" is invalid`);
|
||||
}
|
||||
} catch (err) {
|
||||
showError({
|
||||
@ -698,6 +705,9 @@ export const exportRequestsToFile = (requestIds: string[]) => async dispatch =>
|
||||
'json',
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachableCase(`selected export format "${selectedFormat}" is invalid`);
|
||||
}
|
||||
} catch (err) {
|
||||
showError({
|
||||
|
13
packages/insomnia-app/package-lock.json
generated
13
packages/insomnia-app/package-lock.json
generated
@ -24462,6 +24462,14 @@
|
||||
"utf8-byte-length": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"ts-assert-unreachable": {
|
||||
"version": "0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/ts-assert-unreachable/-/ts-assert-unreachable-0.0.9.tgz",
|
||||
"integrity": "sha512-8tpQLahyZSNTSxKS8QPIO0AAxF8VB02tLPNqcMF638gNDOrhr8uGx9SFP1C/Vtbib2Xc/u12hiXnwmqD7pn+2A==",
|
||||
"requires": {
|
||||
"ts-tiny-invariant": "0.0.3"
|
||||
}
|
||||
},
|
||||
"ts-dedent": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-1.1.1.tgz",
|
||||
@ -24587,6 +24595,11 @@
|
||||
"integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==",
|
||||
"dev": true
|
||||
},
|
||||
"ts-tiny-invariant": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/ts-tiny-invariant/-/ts-tiny-invariant-0.0.3.tgz",
|
||||
"integrity": "sha512-EiaBUsUta7PPzVKpvZurcSDgaSkymxwiUc2rhX6Wu30bws2maipT6ihbEY072dU9lz6/FoFWEc6psXdlo0xqtg=="
|
||||
},
|
||||
"tsconfig-paths": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz",
|
||||
|
@ -154,6 +154,7 @@
|
||||
"styled-components": "^4.4.1",
|
||||
"swagger-ui-react": "^3.24.3",
|
||||
"tough-cookie": "^2.3.1",
|
||||
"ts-assert-unreachable": "^0.0.9",
|
||||
"url-join": "^4.0.1",
|
||||
"uuid": "^3.0.0",
|
||||
"vkbeautify": "^0.99.1",
|
||||
|
Loading…
Reference in New Issue
Block a user