hotfix - INS-782

This commit is contained in:
Dimitri Mitropoulos 2021-07-01 15:52:35 -04:00
parent c2c41f3d84
commit ef840cd516
3 changed files with 39 additions and 15 deletions

View File

@ -43,6 +43,7 @@ import { Settings } from '../../../models/settings';
import { GrpcRequest } from '../../../models/grpc-request'; import { GrpcRequest } from '../../../models/grpc-request';
import { Request } from '../../../models/request'; import { Request } from '../../../models/request';
import { Environment } from '../../../models/environment'; import { Environment } from '../../../models/environment';
import { unreachableCase } from 'ts-assert-unreachable';
export const LOCALSTORAGE_PREFIX = 'insomnia::meta'; export const LOCALSTORAGE_PREFIX = 'insomnia::meta';
const LOGIN_STATE_CHANGE = 'global/login-state-change'; const LOGIN_STATE_CHANGE = 'global/login-state-change';
@ -489,11 +490,7 @@ export const importUri = (
}; };
function showSelectExportTypeModal(onCancel: () => void, onDone: (selectedFormat: SelectedFormat) => void) { function showSelectExportTypeModal(onCancel: () => void, onDone: (selectedFormat: SelectedFormat) => void) {
const lastFormat = window.localStorage.getItem('insomnia.lastExportFormat'); const options = [
showModal(SelectModal, {
title: 'Select Export Type',
value: lastFormat,
options: [
{ {
name: 'Insomnia v4 (JSON)', name: 'Insomnia v4 (JSON)',
value: VALUE_JSON, value: VALUE_JSON,
@ -506,7 +503,14 @@ function showSelectExportTypeModal(onCancel: () => void, onDone: (selectedFormat
name: 'HAR HTTP Archive Format', name: 'HAR HTTP Archive Format',
value: VALUE_HAR, 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: defaultValue,
options,
message: 'Which format would you like to export as?', message: 'Which format would you like to export as?',
onCancel, onCancel,
onDone: (selectedFormat: SelectedFormat) => { onDone: (selectedFormat: SelectedFormat) => {
@ -599,6 +603,9 @@ export const exportWorkspacesToFile = (workspaceId: string | undefined = undefin
'json', 'json',
); );
break; break;
default:
unreachableCase(`selected export format "${selectedFormat}" is invalid`);
} }
} catch (err) { } catch (err) {
showError({ showError({
@ -698,6 +705,9 @@ export const exportRequestsToFile = (requestIds: string[]) => async dispatch =>
'json', 'json',
); );
break; break;
default:
unreachableCase(`selected export format "${selectedFormat}" is invalid`);
} }
} catch (err) { } catch (err) {
showError({ showError({

View File

@ -24462,6 +24462,14 @@
"utf8-byte-length": "^1.0.1" "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": { "ts-dedent": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-1.1.1.tgz", "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==", "integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==",
"dev": true "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": { "tsconfig-paths": {
"version": "3.9.0", "version": "3.9.0",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz",

View File

@ -154,6 +154,7 @@
"styled-components": "^4.4.1", "styled-components": "^4.4.1",
"swagger-ui-react": "^3.24.3", "swagger-ui-react": "^3.24.3",
"tough-cookie": "^2.3.1", "tough-cookie": "^2.3.1",
"ts-assert-unreachable": "^0.0.9",
"url-join": "^4.0.1", "url-join": "^4.0.1",
"uuid": "^3.0.0", "uuid": "^3.0.0",
"vkbeautify": "^0.99.1", "vkbeautify": "^0.99.1",