mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
201 lines
5.1 KiB
201 lines
5.1 KiB
3 years ago
|
<!-- eslint-disable -->
|
||
2 years ago
|
<!-- todo: update prop mutation with emit -->
|
||
|
<template>
|
||
4 years ago
|
<v-container fluid>
|
||
|
<v-simple-table class="ignore-height-style" dense>
|
||
3 years ago
|
<template #default>
|
||
4 years ago
|
<thead>
|
||
3 years ago
|
<tr>
|
||
|
<th class="text-left caption" width="5%" />
|
||
2 years ago
|
<th class="text-left caption">Header Name</th>
|
||
|
<th class="text-left caption">Value</th>
|
||
3 years ago
|
<th class="text-left caption" width="5%" />
|
||
|
</tr>
|
||
4 years ago
|
</thead>
|
||
|
<draggable v-if="value" v-model="headersList" tag="tbody">
|
||
2 years ago
|
<tr v-for="(item, i) in headersList" :key="i">
|
||
4 years ago
|
<td>
|
||
|
<v-checkbox
|
||
3 years ago
|
v-model="item.enabled"
|
||
2 years ago
|
v-ge="['api-client-headers', 'enable']"
|
||
4 years ago
|
small
|
||
|
class="mt-0"
|
||
|
color="primary lighten-1"
|
||
|
hide-details
|
||
3 years ago
|
dense
|
||
|
/>
|
||
4 years ago
|
</td>
|
||
|
<td>
|
||
|
<v-combobox
|
||
3 years ago
|
v-model="item.name"
|
||
2 years ago
|
v-ge="['api-client-headers', 'enable']"
|
||
3 years ago
|
class="body-2 caption nc-input-hook-header-key"
|
||
4 years ago
|
:items="headerListAuto"
|
||
4 years ago
|
:disabled="!item.enabled"
|
||
|
hide-details
|
||
|
single-line
|
||
|
dense
|
||
|
placeholder="Key"
|
||
2 years ago
|
@update:search-input="
|
||
|
e => {
|
||
|
if (i === value.length - 1 && e && e.length) value.push({ name: '', value: '', enabled: true });
|
||
|
}
|
||
|
"
|
||
3 years ago
|
/>
|
||
4 years ago
|
</td>
|
||
|
<td style="height: auto">
|
||
|
<xAutoComplete
|
||
3 years ago
|
v-model="item.value"
|
||
3 years ago
|
class="body-2 caption nc-input-hook-header-value"
|
||
4 years ago
|
:disabled="!item.enabled"
|
||
|
placeholder="Value"
|
||
|
hide-details
|
||
|
single-line
|
||
|
dense
|
||
|
:env="env"
|
||
3 years ago
|
/>
|
||
4 years ago
|
</td>
|
||
|
<td class="">
|
||
|
<x-icon
|
||
2 years ago
|
v-ge="['api-client-headers', 'delete']"
|
||
4 years ago
|
color="error grey"
|
||
3 years ago
|
small
|
||
|
tooltip="Delete param"
|
||
2 years ago
|
@click="value.splice(i, 1)"
|
||
3 years ago
|
>
|
||
|
mdi-delete-outline
|
||
4 years ago
|
</x-icon>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</draggable>
|
||
|
</template>
|
||
|
</v-simple-table>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
2 years ago
|
import draggable from 'vuedraggable';
|
||
4 years ago
|
|
||
3 years ago
|
export default {
|
||
|
directives: {},
|
||
|
components: { draggable },
|
||
3 years ago
|
validate({ params }) {
|
||
2 years ago
|
return true;
|
||
3 years ago
|
},
|
||
|
props: { value: Array, env: String },
|
||
3 years ago
|
data() {
|
||
3 years ago
|
return {
|
||
2 years ago
|
headerListAuto: [
|
||
|
'A-IM',
|
||
|
'Accept',
|
||
|
'Accept-Charset',
|
||
|
'Accept-Encoding',
|
||
|
'Accept-Language',
|
||
|
'Accept-Datetime',
|
||
|
'Access-Control-Request-Method',
|
||
|
'Access-Control-Request-Headers',
|
||
|
'Authorization',
|
||
|
'Cache-Control',
|
||
|
'Connection',
|
||
|
'Content-Length',
|
||
|
'Content-Type',
|
||
|
'Cookie',
|
||
|
'Date',
|
||
|
'Expect',
|
||
|
'Forwarded',
|
||
|
'From',
|
||
|
'Host',
|
||
|
'If-Match',
|
||
|
'If-Modified-Since',
|
||
|
'If-None-Match',
|
||
|
'If-Range',
|
||
|
'If-Unmodified-Since',
|
||
|
'Max-Forwards',
|
||
|
'Origin',
|
||
|
'Pragma',
|
||
|
'Proxy-Authorization',
|
||
|
'Range',
|
||
|
'Referer',
|
||
|
'TE',
|
||
|
'User-Agent',
|
||
|
'Upgrade',
|
||
|
'Via',
|
||
|
'Warning',
|
||
|
'Non-standard headers',
|
||
|
'Dnt',
|
||
|
'X-Requested-With',
|
||
|
'X-CSRF-Token',
|
||
|
],
|
||
|
};
|
||
3 years ago
|
},
|
||
3 years ago
|
head() {
|
||
2 years ago
|
return {};
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
|
headersList: {
|
||
|
// two way binding(v-model)
|
||
3 years ago
|
get() {
|
||
2 years ago
|
return this.value;
|
||
4 years ago
|
},
|
||
3 years ago
|
set(value) {
|
||
2 years ago
|
this.$emit('input', value);
|
||
|
},
|
||
|
},
|
||
3 years ago
|
},
|
||
|
watch: {
|
||
|
value: {
|
||
3 years ago
|
handler(val) {
|
||
3 years ago
|
// keeps at least one param row
|
||
2 years ago
|
if (!val || !val.length) {
|
||
|
this.$emit('input', [{ name: '', value: '', enabled: true }]);
|
||
|
}
|
||
|
},
|
||
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
created() {
|
||
3 years ago
|
// keeps at least one param row
|
||
|
if (!this.value || !this.value.length) {
|
||
2 years ago
|
this.$emit('input', [
|
||
|
{
|
||
|
name: '',
|
||
|
value: '',
|
||
|
enabled: true,
|
||
|
},
|
||
|
]);
|
||
3 years ago
|
}
|
||
|
},
|
||
2 years ago
|
mounted() {},
|
||
|
beforeDestroy() {},
|
||
3 years ago
|
methods: {},
|
||
|
|
||
2 years ago
|
beforeCreated() {},
|
||
|
destroy() {},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
2 years ago
|
<style scoped></style>
|
||
4 years ago
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|