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.
162 lines
4.2 KiB
162 lines
4.2 KiB
3 years ago
|
<!-- eslint-disable -->
|
||
|
<!-- todo: update prop mutation with emit -->
|
||
3 years ago
|
<template>
|
||
|
<v-container fluid>
|
||
|
<v-simple-table class="ignore-height-style params-table" style="" dense>
|
||
3 years ago
|
<template #default>
|
||
3 years ago
|
<thead>
|
||
3 years ago
|
<tr>
|
||
|
<th class="text-left caption" width="5%" />
|
||
|
<th class="text-left caption grey--text" width="40%">
|
||
|
Param Name
|
||
|
</th>
|
||
|
<th class="text-left caption grey--text" width="40%">
|
||
|
Value
|
||
|
</th>
|
||
|
<th class="text-left caption" width="5%" />
|
||
|
</tr>
|
||
3 years ago
|
</thead>
|
||
|
<!-- <tbody>-->
|
||
|
<draggable v-if="value" v-model="paramList" tag="tbody">
|
||
|
<tr v-for="(item,i) in paramList" :key="i">
|
||
|
<td>
|
||
|
<v-checkbox
|
||
3 years ago
|
v-model="item.enabled"
|
||
3 years ago
|
v-ge="['api-client-params','enable']"
|
||
|
small
|
||
|
class="mt-0 caption"
|
||
|
color="primary lighten-1"
|
||
|
hide-details
|
||
3 years ago
|
dense
|
||
|
/>
|
||
3 years ago
|
</td>
|
||
|
<td>
|
||
|
<xAutoComplete
|
||
3 years ago
|
v-model="item.name"
|
||
3 years ago
|
class="body-2 caption"
|
||
|
:disabled="!item.enabled"
|
||
|
placeholder="Key"
|
||
|
hide-details
|
||
|
single-line
|
||
|
dense
|
||
|
:env="env"
|
||
3 years ago
|
@input="() => { if(i === value.length - 1 && item.name.length) value.push({name:'',value:'',
|
||
|
enabled:true}) }"
|
||
|
/>
|
||
3 years ago
|
</td>
|
||
|
<td style="height: auto">
|
||
|
<xAutoComplete
|
||
|
v-model="item.value"
|
||
3 years ago
|
class="body-2 caption"
|
||
3 years ago
|
:disabled="!item.enabled"
|
||
|
:placeholder="item.description || 'Value'"
|
||
|
hide-details
|
||
|
single-line
|
||
|
dense
|
||
|
:env="env"
|
||
3 years ago
|
/>
|
||
3 years ago
|
</td>
|
||
|
<td class="">
|
||
|
<x-icon
|
||
|
v-ge="['api-client-params','delete']"
|
||
|
color="error grey"
|
||
3 years ago
|
small
|
||
|
tooltip="Delete param"
|
||
|
@click="value.splice(i,1)"
|
||
|
>
|
||
|
mdi-delete-outline
|
||
3 years ago
|
</x-icon>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</draggable>
|
||
|
</template>
|
||
|
</v-simple-table>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
3 years ago
|
import draggable from 'vuedraggable'
|
||
3 years ago
|
|
||
3 years ago
|
export default {
|
||
|
directives: {},
|
||
|
components: { draggable },
|
||
3 years ago
|
validate({ params }) {
|
||
3 years ago
|
return true
|
||
|
},
|
||
|
props: { value: Array, env: String },
|
||
3 years ago
|
data() {
|
||
3 years ago
|
return {}
|
||
|
},
|
||
3 years ago
|
head() {
|
||
3 years ago
|
return {}
|
||
|
},
|
||
|
computed: {
|
||
|
paramList: {
|
||
|
// two way binding(v-model)
|
||
3 years ago
|
get() {
|
||
3 years ago
|
return this.value
|
||
3 years ago
|
},
|
||
3 years ago
|
set(value) {
|
||
3 years ago
|
this.$emit('input', value)
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
value: {
|
||
3 years ago
|
handler(val) {
|
||
3 years ago
|
// keeps at least one param row
|
||
|
if (!val || !val.length) { this.$emit('input', [{ name: '', value: '', enabled: true }]) }
|
||
|
}
|
||
|
}
|
||
|
},
|
||
3 years ago
|
created() {
|
||
3 years ago
|
// creating value if not exist
|
||
|
if (!this.value || !this.value.length) {
|
||
|
this.$emit('input', [{
|
||
3 years ago
|
name: '',
|
||
|
value: '',
|
||
|
enabled: true
|
||
3 years ago
|
}])
|
||
|
}
|
||
|
},
|
||
3 years ago
|
mounted() {
|
||
3 years ago
|
},
|
||
3 years ago
|
beforeDestroy() {
|
||
3 years ago
|
},
|
||
|
methods: {},
|
||
|
|
||
3 years ago
|
beforeCreated() {
|
||
3 years ago
|
},
|
||
3 years ago
|
destroy() {
|
||
3 years ago
|
}
|
||
|
}
|
||
3 years ago
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|