From d620e73ef8697bfb07067c83f44f9354d882ffca Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 22 Nov 2016 19:07:35 -0800 Subject: [PATCH] Small tweaks and support importers 0.4 --- app/common/constants.js | 2 +- app/common/import.js | 9 ++++++--- app/package.json | 2 +- app/ui/components/RequestPane.js | 17 ++++++++--------- app/ui/components/RequestUrlBar.js | 4 ++-- app/ui/components/base/FileInputButton.js | 2 +- package.json | 2 +- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/common/constants.js b/app/common/constants.js index 8054a523c..aeb033020 100644 --- a/app/common/constants.js +++ b/app/common/constants.js @@ -124,8 +124,8 @@ export const contentTypesMap = { [CONTENT_TYPE_XML]: 'XML', // [CONTENT_TYPE_FORM_DATA]: 'Form Data', [CONTENT_TYPE_FORM_URLENCODED]: 'Form Url Encoded', - [CONTENT_TYPE_TEXT]: 'Plain Text', [CONTENT_TYPE_FILE]: 'File Upload', + [CONTENT_TYPE_TEXT]: 'Plain Text', [CONTENT_TYPE_RAW]: 'Raw Body', }; diff --git a/app/common/import.js b/app/common/import.js index 1dafb01b5..7664318fc 100644 --- a/app/common/import.js +++ b/app/common/import.js @@ -4,6 +4,8 @@ import * as models from '../models'; import {getAppVersion} from './constants'; import * as misc from './misc'; +const EXPORT_FORMAT = 3; + const EXPORT_TYPE_REQUEST = 'request'; const EXPORT_TYPE_REQUEST_GROUP = 'request_group'; const EXPORT_TYPE_WORKSPACE = 'workspace'; @@ -90,7 +92,7 @@ export async function importRaw (workspace, rawContent, generateNewIds = false) export async function exportJSON (parentDoc = null) { const data = { _type: 'export', - __export_format: 2, + __export_format: EXPORT_FORMAT, __export_date: new Date(), __export_source: `insomnia.desktop.app:v${getAppVersion()}`, resources: {} @@ -115,11 +117,12 @@ export async function exportJSON (parentDoc = null) { d._type = EXPORT_TYPE_REQUEST; } - // Delete the type property because we add our own (_type) + // Delete the things we don't want to export delete d.type; + delete d._schema; return d; }); - return JSON.stringify(data, null, 2); + return JSON.stringify(data, null, '\t'); } diff --git a/app/package.json b/app/package.json index fb2b2559d..760f2754c 100644 --- a/app/package.json +++ b/app/package.json @@ -16,7 +16,7 @@ "electron-squirrel-startup": "^1.0.0", "hkdf": "0.0.2", "httpsnippet": "git@github.com:getinsomnia/httpsnippet.git#a3a2c0a0167fa844bf92df52a1442fa1d68a9053", - "insomnia-importers": "^0.3.1", + "insomnia-importers": "^0.4.0", "json-lint": "^0.1.0", "jsonpath-plus": "^0.15.0", "mime-types": "^2.1.12", diff --git a/app/ui/components/RequestPane.js b/app/ui/components/RequestPane.js index 7784496d3..3f20980b9 100644 --- a/app/ui/components/RequestPane.js +++ b/app/ui/components/RequestPane.js @@ -84,6 +84,10 @@ class RequestPane extends Component { ) } + const numParameters = request.parameters.filter(p => !p.disabled).length; + const numHeaders = request.headers.filter(h => !h.disabled).length; + const hasAuth = !request.authentication.disabled; + return (
@@ -106,22 +110,17 @@ class RequestPane extends Component { @@ -152,7 +151,7 @@ class RequestPane extends Component { diff --git a/app/ui/components/RequestUrlBar.js b/app/ui/components/RequestUrlBar.js index a463d31ac..0382a7b91 100644 --- a/app/ui/components/RequestUrlBar.js +++ b/app/ui/components/RequestUrlBar.js @@ -49,9 +49,9 @@ class RequestUrlBar extends Component { {method} {METHODS.map(method => ( - { + { onMethodChange(method); - trackEvent('Request', 'Method Change', {method}); + trackEvent('Request', 'Method Change', method); }}> {method} diff --git a/app/ui/components/base/FileInputButton.js b/app/ui/components/base/FileInputButton.js index 13e27ee3e..16109db89 100644 --- a/app/ui/components/base/FileInputButton.js +++ b/app/ui/components/base/FileInputButton.js @@ -40,7 +40,7 @@ class FileInputButton extends Component { addIcon={true} onClick={e => this._handleUnsetFile()}> - Unset + Clear File ) diff --git a/package.json b/package.json index 44270039e..cc469c9d5 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "electron-squirrel-startup": "^1.0.0", "hkdf": "0.0.2", "httpsnippet": "git@github.com:getinsomnia/httpsnippet.git#a3a2c0a0167fa844bf92df52a1442fa1d68a9053", - "insomnia-importers": "^0.3.1", + "insomnia-importers": "^0.4.0", "json-lint": "^0.1.0", "jsonpath-plus": "^0.15.0", "mime-types": "^2.1.12",