Merge branch 'master' into feat/extension-toggle

This commit is contained in:
Andrew Bastin
2020-02-04 13:17:46 -05:00
committed by GitHub
3 changed files with 157 additions and 22 deletions

View File

@@ -538,6 +538,7 @@ input[type="radio"],
display: none; display: none;
} }
.method,
kbd, kbd,
select, select,
input, input,
@@ -557,6 +558,7 @@ code {
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
user-select: text; user-select: text;
width: calc(100% - 8px); width: calc(100% - 8px);
min-width: 128px;
resize: vertical; resize: vertical;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -587,6 +589,14 @@ pre {
.select-wrapper { .select-wrapper {
position: relative; position: relative;
input {
text-transform: uppercase;
}
.trigger {
width: 100%;
}
&:after { &:after {
display: inline-block; display: inline-block;
position: absolute; position: absolute;

View File

@@ -566,19 +566,19 @@
<div slot="body"> <div slot="body">
<div> <div>
<label>{{ $t("send_request") }}</label> <label>{{ $t("send_request") }}</label>
<kbd> G</kbd> <kbd>{{ getSpecialKey() }} G</kbd>
</div> </div>
<div> <div>
<label>{{ $t("save_to_collections") }}</label> <label>{{ $t("save_to_collections") }}</label>
<kbd> S</kbd> <kbd>{{ getSpecialKey() }} S</kbd>
</div> </div>
<div> <div>
<label>{{ $t("copy_request_link") }}</label> <label>{{ $t("copy_request_link") }}</label>
<kbd> K</kbd> <kbd>{{ getSpecialKey() }} K</kbd>
</div> </div>
<div> <div>
<label>{{ $t("reset_request") }}</label> <label>{{ $t("reset_request") }}</label>
<kbd> L</kbd> <kbd>{{ getSpecialKey() }} L</kbd>
</div> </div>
</div> </div>
<div slot="footer"></div> <div slot="footer"></div>
@@ -677,6 +677,9 @@ export default {
}, },
methods: { methods: {
getSpecialKey() {
return (/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) ? "⌘" : "Ctrl";
},
linkActive(path) { linkActive(path) {
return { return {
"nuxt-link-exact-active": this.$route.path === path, "nuxt-link-exact-active": this.$route.path === path,

View File

@@ -45,17 +45,138 @@
<li> <li>
<label for="method">{{ $t("method") }}</label> <label for="method">{{ $t("method") }}</label>
<span class="select-wrapper"> <span class="select-wrapper">
<select id="method" v-model="method" @change="methodChange"> <v-popover>
<option value="GET">GET</option> <input
<option value="HEAD">HEAD</option> id="method"
<option value="POST">POST</option> class="method"
<option value="PUT">PUT</option> v-if="!customMethod"
<option value="DELETE">DELETE</option> v-model="method"
<option value="CONNECT">CONNECT</option> readonly
<option value="OPTIONS">OPTIONS</option> />
<option value="TRACE">TRACE</option> <input v-else v-model="method" placeholder="CUSTOM" />
<option value="PATCH">PATCH</option> <template slot="popover">
</select> <div>
<button
class="icon"
@click="
customMethod = false;
method = 'GET';
"
v-close-popover
>
GET
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'HEAD';
"
v-close-popover
>
HEAD
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'POST';
"
v-close-popover
>
POST
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'PUT';
"
v-close-popover
>
PUT
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'DELETE';
"
v-close-popover
>
DELETE
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'CONNECT';
"
v-close-popover
>
CONNECT
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'OPTIONS';
"
v-close-popover
>
OPTIONS
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'TRACE';
"
v-close-popover
>
TRACE
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = false;
method = 'PATCH';
"
v-close-popover
>
PATCH
</button>
</div>
<div>
<button
class="icon"
@click="
customMethod = true;
method = 'CUSTOM';
"
v-close-popover
>
CUSTOM
</button>
</div>
</template>
</v-popover>
</span> </span>
</li> </li>
<li> <li>
@@ -1484,7 +1605,8 @@ export default {
responseBodyType: "text", responseBodyType: "text",
responseBodyMaxLines: 16, responseBodyMaxLines: 16,
activeSidebar: true, activeSidebar: true,
fb fb,
customMethod: false
}; };
}, },
watch: { watch: {
@@ -1574,6 +1696,12 @@ export default {
editingRequest(newValue) { editingRequest(newValue) {
this.editRequest = newValue; this.editRequest = newValue;
this.showRequestModal = true; this.showRequestModal = true;
},
method() {
// this.$store.commit('setState', { 'value': ["POST", "PUT", "PATCH"].includes(this.method) ? 'application/json' : '', 'attribute': 'contentType' })
this.contentType = ["POST", "PUT", "PATCH"].includes(this.method)
? "application/json"
: "";
} }
}, },
computed: { computed: {
@@ -2669,12 +2797,6 @@ export default {
} }
this.setRouteQueryState(); this.setRouteQueryState();
}, },
methodChange() {
// this.$store.commit('setState', { 'value': ["POST", "PUT", "PATCH"].includes(this.method) ? 'application/json' : '', 'attribute': 'contentType' })
this.contentType = ["POST", "PUT", "PATCH"].includes(this.method)
? "application/json"
: "";
},
uploadPayload() { uploadPayload() {
this.rawInput = true; this.rawInput = true;
const file = this.$refs.payload.files[0]; const file = this.$refs.payload.files[0];