mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-06 02:06:52 +00:00
refactor: prettier nc-gui v1
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
dense
|
||||
class="caption nc-select-hook-url-method"
|
||||
:items="Object.keys(apiMethodMeta)"
|
||||
style="max-width:100px;"
|
||||
style="max-width: 100px"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="api.path"
|
||||
@@ -18,29 +18,21 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<v-tabs
|
||||
v-model="tab"
|
||||
class="req-tabs"
|
||||
height="24"
|
||||
>
|
||||
<v-tab v-ge="['api-client','body']" class="caption">
|
||||
<v-tabs v-model="tab" class="req-tabs" height="24">
|
||||
<v-tab v-ge="['api-client', 'body']" class="caption">
|
||||
<span class="text-capitalize">Body</span>
|
||||
</v-tab>
|
||||
<v-tab v-ge="['api-client','params']" class="caption">
|
||||
<span class="text-capitalize"> Params <b
|
||||
v-if="paramsCount"
|
||||
class="green--text"
|
||||
>({{ paramsCount }})</b></span>
|
||||
<v-tab v-ge="['api-client', 'params']" class="caption">
|
||||
<span class="text-capitalize">
|
||||
Params <b v-if="paramsCount" class="green--text">({{ paramsCount }})</b></span
|
||||
>
|
||||
</v-tab>
|
||||
<v-tab v-ge="['api-client','headers']" class="caption">
|
||||
<span class="text-capitalize nc-tab-hook-header">Headers <b
|
||||
v-if="headersCount"
|
||||
class="green--text"
|
||||
>({{
|
||||
headersCount
|
||||
}})</b></span>
|
||||
<v-tab v-ge="['api-client', 'headers']" class="caption">
|
||||
<span class="text-capitalize nc-tab-hook-header"
|
||||
>Headers <b v-if="headersCount" class="green--text">({{ headersCount }})</b></span
|
||||
>
|
||||
</v-tab>
|
||||
<v-tab v-ge="['api-client','auth']" class="caption">
|
||||
<v-tab v-ge="['api-client', 'auth']" class="caption">
|
||||
<span class="text-capitalize">Auth</span>
|
||||
</v-tab>
|
||||
<v-tab-item>
|
||||
@@ -50,20 +42,14 @@
|
||||
class="editor card text-left"
|
||||
theme="vs-dark"
|
||||
lang="json"
|
||||
:options="{validate:true,documentFormattingEdits:true,foldingRanges:true}"
|
||||
:options="{ validate: true, documentFormattingEdits: true, foldingRanges: true }"
|
||||
/>
|
||||
</v-tab-item>
|
||||
<v-tab-item>
|
||||
<params
|
||||
v-model="api.parameters"
|
||||
:env.sync="selectedEnv"
|
||||
/>
|
||||
<params v-model="api.parameters" :env.sync="selectedEnv" />
|
||||
</v-tab-item>
|
||||
<v-tab-item>
|
||||
<headers
|
||||
v-model="api.headers"
|
||||
:env.sync="selectedEnv"
|
||||
/>
|
||||
<headers v-model="api.headers" :env.sync="selectedEnv" />
|
||||
</v-tab-item>
|
||||
|
||||
<v-tab-item>
|
||||
@@ -72,19 +58,22 @@
|
||||
style="height: 250px"
|
||||
class="editor card text-left"
|
||||
theme="vs-dark"
|
||||
:options="{validate:true,documentFormattingEdits:true,foldingRanges:true}"
|
||||
:options="{ validate: true, documentFormattingEdits: true, foldingRanges: true }"
|
||||
/>
|
||||
<span class="caption grey--text">For more about auth option refer <a href="https://github.com/axios/axios#request-config" target="_blank">axios docs</a>.</span>
|
||||
<span class="caption grey--text"
|
||||
>For more about auth option refer
|
||||
<a href="https://github.com/axios/axios#request-config" target="_blank">axios docs</a>.</span
|
||||
>
|
||||
</v-tab-item>
|
||||
</v-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import params from '../../../apiClient/Params'
|
||||
import headers from '../../../apiClient/Headers'
|
||||
import params from '../../../apiClient/Params';
|
||||
import headers from '../../../apiClient/Headers';
|
||||
|
||||
import { MonacoHandlebarEditor } from '../../../monaco/index'
|
||||
import { MonacoHandlebarEditor } from '../../../monaco/index';
|
||||
|
||||
export default {
|
||||
tab: 0,
|
||||
@@ -92,31 +81,31 @@ export default {
|
||||
components: {
|
||||
params,
|
||||
headers,
|
||||
MonacoHandlebarEditor
|
||||
MonacoHandlebarEditor,
|
||||
},
|
||||
props: {
|
||||
value: Object
|
||||
value: Object,
|
||||
},
|
||||
data: () => ({
|
||||
apiMethodMeta: {
|
||||
GET: {
|
||||
color: 'success'
|
||||
color: 'success',
|
||||
},
|
||||
POST: {
|
||||
color: 'warning'
|
||||
color: 'warning',
|
||||
},
|
||||
DELETE: {
|
||||
color: 'error'
|
||||
color: 'error',
|
||||
},
|
||||
PUT: {
|
||||
color: 'info'
|
||||
color: 'info',
|
||||
},
|
||||
HEAD: {
|
||||
color: 'info'
|
||||
color: 'info',
|
||||
},
|
||||
PATCH: {
|
||||
color: 'info'
|
||||
}
|
||||
color: 'info',
|
||||
},
|
||||
},
|
||||
selectedEnv: '_noco',
|
||||
environmentList: ['_noco'],
|
||||
@@ -130,37 +119,34 @@ export default {
|
||||
headers: [],
|
||||
response: {},
|
||||
perf: {},
|
||||
meta: {}
|
||||
meta: {},
|
||||
},
|
||||
tab: 0
|
||||
tab: 0,
|
||||
}),
|
||||
computed: {
|
||||
|
||||
paramsCount() {
|
||||
return this.api.parameters && this.api.parameters.filter(p => p.name && p.enabled).length
|
||||
return this.api.parameters && this.api.parameters.filter(p => p.name && p.enabled).length;
|
||||
},
|
||||
headersCount() {
|
||||
return this.api.headers && this.api.headers.filter(h => h.name && h.enabled).length
|
||||
}
|
||||
return this.api.headers && this.api.headers.filter(h => h.name && h.enabled).length;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
if (this.api !== this.value) {
|
||||
this.api = this.value || this.api
|
||||
this.api = this.value || this.api;
|
||||
}
|
||||
},
|
||||
api: {
|
||||
handler() {
|
||||
this.$emit('input', this.api)
|
||||
}
|
||||
}
|
||||
this.$emit('input', this.api);
|
||||
},
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.api = this.value || this.api
|
||||
}
|
||||
}
|
||||
this.api = this.value || this.api;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user