fix conflicts
This commit is contained in:
162
pages/index.vue
162
pages/index.vue
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<save-request-as
|
||||
v-bind:show="showRequestModal"
|
||||
v-on:hide-model='hideRequestModal'
|
||||
v-bind:editing-request='editRequest'
|
||||
></save-request-as>
|
||||
<pw-modal v-if="showModal" @close="showModal = false">
|
||||
<div slot="header">
|
||||
<ul>
|
||||
@@ -33,7 +38,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</pw-modal>
|
||||
<pw-section class="blue" label="Request" ref="request">
|
||||
<pw-section class="blue" icon="cloud_upload" label="Request" ref="request">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="method">Method</label>
|
||||
@@ -56,19 +61,8 @@
|
||||
<input @keyup.enter="isValidURL ? sendRequest() : null" id="path" name="path" v-model="path" @input="pathInputHandler">
|
||||
</li>
|
||||
<li>
|
||||
<label class="hide-on-small-screen" for="copyRequest"> </label>
|
||||
<button class="icon" @click="copyRequest" id="copyRequest" ref="copyRequest" :disabled="!isValidURL">
|
||||
<i class="material-icons">share</i>
|
||||
<span>Permalink</span>
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<label class="hide-on-small-screen" for="code"> </label>
|
||||
<button class="icon" id="code" v-on:click="isHidden = !isHidden" :disabled="!isValidURL">
|
||||
<i class="material-icons" v-if="isHidden">visibility</i>
|
||||
<i class="material-icons" v-if="!isHidden">visibility_off</i>
|
||||
<span>{{ isHidden ? 'Show Code' : 'Hide Code' }}</span>
|
||||
</button>
|
||||
<label for="label">Label</label>
|
||||
<input id="label" name="label" type="text" v-model="label" placeholder="(optional)">
|
||||
</li>
|
||||
<li>
|
||||
<label class="hide-on-small-screen" for="send"> </label>
|
||||
@@ -88,7 +82,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<span>
|
||||
<pw-toggle :on="rawInput" @change="rawInput = !rawInput">
|
||||
<pw-toggle :on="rawInput" @change="rawInput = $event">
|
||||
Raw Input {{ rawInput ? "Enabled" : "Disabled" }}
|
||||
</pw-toggle>
|
||||
</span>
|
||||
@@ -148,27 +142,30 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<input id="label" name="label" type="text" v-model="label" placeholder="Label request">
|
||||
</li>
|
||||
</ul>
|
||||
<div class="flex-wrap">
|
||||
<button class="icon" id="show-modal" @click="showModal = true">
|
||||
<i class="material-icons">import_export</i>
|
||||
<span>Import cURL</span>
|
||||
</button>
|
||||
<button class="icon" id="goto-history" @click="gotoHistory()">
|
||||
<i class="material-icons">history</i>
|
||||
<span>History</span>
|
||||
</button>
|
||||
<button class="icon" @click="clearContent">
|
||||
<i class="material-icons">clear_all</i>
|
||||
<span>Clear all</span>
|
||||
</button>
|
||||
<div style="text-align: center;">
|
||||
<button class="icon" id="show-modal" @click="showModal = true" v-tooltip.bottom='"Import cURL"'>
|
||||
<i class="material-icons">import_export</i>
|
||||
</button>
|
||||
<button class="icon" id="code" v-on:click="isHidden = !isHidden" :disabled="!isValidURL" v-tooltip.bottom='{ content: isHidden ? "Show Code" : "Hide Code"}'>
|
||||
<i class="material-icons" v-if="isHidden">visibility</i>
|
||||
<i class="material-icons" v-if="!isHidden">visibility_off</i>
|
||||
</button>
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<button class="icon" @click="copyRequest" id="copyRequest" ref="copyRequest" :disabled="!isValidURL" v-tooltip.bottom='"Sharable request URL"'>
|
||||
<i class="material-icons">share</i>
|
||||
</button>
|
||||
<button class="icon" @click="saveRequest" id="saveRequest" ref="saveRequest" :disabled="!isValidURL" v-tooltip.bottom='"Save to Collections"'>
|
||||
<i class="material-icons">save</i>
|
||||
</button>
|
||||
<button class="icon" @click="clearContent" v-tooltip.bottom='"Clear all"'>
|
||||
<i class="material-icons">clear_all</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</pw-section>
|
||||
<pw-section class="yellow" label="Code" ref="requestCode" v-if="!isHidden">
|
||||
<pw-section class="yellow" icon="code" label="Code" ref="requestCode" v-if="!isHidden">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="requestType">Request Type</label>
|
||||
@@ -194,7 +191,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</pw-section>
|
||||
<pw-section class="purple" id="response" label="Response" ref="response">
|
||||
<pw-section class="purple" icon="cloud_download" id="response" label="Response" ref="response">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="status">status</label>
|
||||
@@ -236,7 +233,7 @@
|
||||
<input id="tab-one" type="radio" name="grp" checked="checked">
|
||||
<label for="tab-one">Authentication</label>
|
||||
<div class="tab">
|
||||
<pw-section class="cyan" label="Authentication">
|
||||
<pw-section class="cyan" icon="vpn_key" label="Authentication">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
@@ -281,7 +278,7 @@
|
||||
<input id="tab-two" type="radio" name="grp">
|
||||
<label for="tab-two">Headers</label>
|
||||
<div class="tab">
|
||||
<pw-section class="orange" label="Headers">
|
||||
<pw-section class="orange" icon="toc" label="Headers">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
@@ -337,7 +334,7 @@
|
||||
<input id="tab-three" type="radio" name="grp">
|
||||
<label for="tab-three">Parameters</label>
|
||||
<div class="tab">
|
||||
<pw-section class="pink" label="Parameters">
|
||||
<pw-section class="pink" icon="input" label="Parameters">
|
||||
<ul>
|
||||
<li>
|
||||
<div class="flex-wrap">
|
||||
@@ -390,6 +387,9 @@
|
||||
</div>
|
||||
</section>
|
||||
<history @useHistory="handleUseHistory" ref="historyComponent"></history>
|
||||
<pw-section class="yellow" icon="folder_special" label="Collections" ref="Collections">
|
||||
<collections></collections>
|
||||
</pw-section>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -401,6 +401,8 @@
|
||||
import textareaAutoHeight from "../directives/textareaAutoHeight";
|
||||
import toggle from "../components/toggle";
|
||||
import modal from "../components/modal";
|
||||
import collections from '../components/collections';
|
||||
import saveRequestAs from '../components/collections/saveRequestAs';
|
||||
import parseCurlCommand from '../assets/js/curlparser.js';
|
||||
import hljs from 'highlight.js';
|
||||
import 'highlight.js/styles/dracula.css';
|
||||
@@ -463,6 +465,8 @@
|
||||
'pw-modal': modal,
|
||||
history,
|
||||
autocomplete,
|
||||
collections,
|
||||
saveRequestAs,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -497,7 +501,9 @@
|
||||
'application/x-www-form-urlencoded',
|
||||
'text/html',
|
||||
'text/plain'
|
||||
]
|
||||
],
|
||||
showRequestModal: false,
|
||||
editRequest: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -552,6 +558,29 @@
|
||||
this.path = path;
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
selectedRequest (newValue, oldValue) {
|
||||
// @TODO: Convert all variables to single request variable
|
||||
if (!newValue) return;
|
||||
this.url = newValue.url;
|
||||
this.path = newValue.path;
|
||||
this.method = newValue.method;
|
||||
this.auth = newValue.auth;
|
||||
this.httpUser = newValue.httpUser;
|
||||
this.httpPassword = newValue.httpPassword;
|
||||
this.passwordFieldType = newValue.passwordFieldType;
|
||||
this.bearerToken = newValue.bearerToken;
|
||||
this.headers = newValue.headers;
|
||||
this.params = newValue.params;
|
||||
this.bodyParams = newValue.bodyParams;
|
||||
this.rawParams = newValue.rawParams;
|
||||
this.rawInput = newValue.rawInput;
|
||||
this.contentType = newValue.contentType;
|
||||
this.requestType = newValue.requestType;
|
||||
},
|
||||
editingRequest (newValue) {
|
||||
this.editRequest = newValue;
|
||||
this.showRequestModal = true;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -617,7 +646,13 @@
|
||||
},
|
||||
passwordFieldType: {
|
||||
get() { return this.$store.state.request.passwordFieldType; },
|
||||
set(value) { this.$store.commit('setState', { value, 'attribute': 'passwordFieldType' })}
|
||||
set(value) { this.$store.commit('setState', { value, 'attribute': 'passwordFieldType' }) }
|
||||
},
|
||||
selectedRequest() {
|
||||
return this.$store.state.postwoman.selectedRequest;
|
||||
},
|
||||
editingRequest() {
|
||||
return this.$store.state.postwoman.editingRequest;
|
||||
},
|
||||
requestName() {
|
||||
return this.label
|
||||
@@ -909,6 +944,7 @@
|
||||
this.$refs.historyComponent.addEntry(entry);
|
||||
})();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
if (error.response) {
|
||||
this.response.headers = error.response.headers;
|
||||
this.response.status = error.response.status;
|
||||
@@ -929,7 +965,7 @@
|
||||
} else {
|
||||
this.response.status = error.message;
|
||||
this.response.body = "See JavaScript console (F12) for details.";
|
||||
this.$toast.error('Something went wrong!', {
|
||||
this.$toast.error(error + ' (F12 for details)', {
|
||||
icon: 'error'
|
||||
});
|
||||
if(!this.$store.state.postwoman.settings.PROXY_ENABLED) {
|
||||
@@ -947,11 +983,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
gotoHistory() {
|
||||
this.$refs.historyComponent.$el.scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
},
|
||||
getQueryStringFromPath() {
|
||||
let queryString,
|
||||
pathParsed = url.parse(this.path);
|
||||
@@ -1037,17 +1068,17 @@
|
||||
}).then(() => {})
|
||||
.catch(console.error);
|
||||
} else {
|
||||
this.$refs.copyRequest.innerHTML = this.copiedButton + '<span>Copied</span>';
|
||||
this.$toast.success('Copied to clipboard', {
|
||||
icon: 'done'
|
||||
});
|
||||
var dummy = document.createElement('input');
|
||||
document.body.appendChild(dummy);
|
||||
dummy.value = window.location.href;
|
||||
dummy.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(dummy);
|
||||
setTimeout(() => this.$refs.copyRequest.innerHTML = this.copyButton + '<span>Permalink</span>', 1000)
|
||||
this.$refs.copyRequest.innerHTML = this.copiedButton;
|
||||
this.$toast.success('Copied to clipboard', {
|
||||
icon: 'done'
|
||||
});
|
||||
setTimeout(() => this.$refs.copyRequest.innerHTML = '<i class="material-icons">share</i>', 1000)
|
||||
}
|
||||
},
|
||||
copyRequestCode() {
|
||||
@@ -1199,7 +1230,36 @@
|
||||
this.$toast.info('Cleared', {
|
||||
icon: 'clear_all'
|
||||
});
|
||||
}
|
||||
},
|
||||
saveRequest() {
|
||||
this.editRequest = {
|
||||
url: this.url,
|
||||
path: this.path,
|
||||
method: this.method,
|
||||
auth: this.auth,
|
||||
httpUser: this.httpUser,
|
||||
httpPassword: this.httpPassword,
|
||||
passwordFieldType: this.passwordFieldType,
|
||||
bearerToken: this.bearerToken,
|
||||
headers: this.headers,
|
||||
params: this.params,
|
||||
bodyParams: this.bodyParams,
|
||||
rawParams: this.rawParams,
|
||||
rawInput: this.rawInput,
|
||||
contentType: this.contentType,
|
||||
requestType: this.requestType,
|
||||
};
|
||||
|
||||
if (this.selectedRequest.url) {
|
||||
this.editRequest = Object.assign({}, this.selectedRequest, this.editRequest);
|
||||
}
|
||||
|
||||
this.showRequestModal = true;
|
||||
},
|
||||
hideRequestModal() {
|
||||
this.showRequestModal = false;
|
||||
this.editRequest = {};
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.observeRequestButton();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<pw-section class="cyan" label="Theme">
|
||||
<pw-section class="cyan" icon="color_lens" label="Theme">
|
||||
<ul>
|
||||
<li>
|
||||
<h3 class="title">Background</h3>
|
||||
@@ -25,17 +25,17 @@
|
||||
<li>
|
||||
<h3 class="title">Frames</h3>
|
||||
<span>
|
||||
<pw-toggle :on="!settings.DISABLE_FRAME_COLORS" @change="toggleSetting('DISABLE_FRAME_COLORS')">
|
||||
<pw-toggle :on="!settings.DISABLE_FRAME_COLORS" @change="applySetting('DISABLE_FRAME_COLORS', $event)">
|
||||
Multi-color {{ settings.DISABLE_FRAME_COLORS ? "Disabled" : "Enabled" }}
|
||||
</pw-toggle>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</pw-section>
|
||||
<pw-section class="blue" label="Proxy">
|
||||
<pw-section class="blue" icon="public" label="Proxy">
|
||||
<ul>
|
||||
<li>
|
||||
<pw-toggle :on="settings.PROXY_ENABLED" @change="toggleSetting('PROXY_ENABLED')">
|
||||
<pw-toggle :on="settings.PROXY_ENABLED" @change="applySetting('PROXY_ENABLED', $event)">
|
||||
Proxy {{ settings.PROXY_ENABLED ? "enabled" : "disabled" }}
|
||||
</pw-toggle>
|
||||
</li>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<pw-section class="blue" label="Request" ref="request">
|
||||
<pw-section class="blue" icon="cloud_upload" label="Request" ref="request">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="url">URL</label>
|
||||
@@ -18,7 +18,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</pw-section>
|
||||
<pw-section class="purple" label="Communication" id="response" ref="response">
|
||||
<pw-section class="purple" icon="cloud_download" label="Communication" id="response" ref="response">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="log">Log</label>
|
||||
|
||||
Reference in New Issue
Block a user