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.
114 lines
3.0 KiB
114 lines
3.0 KiB
4 years ago
|
<template>
|
||
4 years ago
|
<v-container fluid style="height: 100%" class="px-0">
|
||
4 years ago
|
<v-row style="height: 100%">
|
||
|
<v-col cols="12" class="py-1">
|
||
4 years ago
|
<div class="px-2">
|
||
4 years ago
|
<v-text-field
|
||
3 years ago
|
v-model="url"
|
||
4 years ago
|
class=""
|
||
|
outlined
|
||
|
solo-inverted
|
||
|
single-line
|
||
|
dense
|
||
|
rounded
|
||
|
hide-details
|
||
|
label="Graphql Url"
|
||
|
@keypress.enter="loadUrl"
|
||
|
>
|
||
3 years ago
|
<template #append-outer>
|
||
|
<x-btn
|
||
|
icon="mdi-graphql"
|
||
|
btn.class="mt-n1"
|
||
|
tooltip="Load graphql schema"
|
||
|
color="primary"
|
||
|
@click="loadUrl"
|
||
|
>
|
||
|
Load
|
||
4 years ago
|
</x-btn>
|
||
|
</template>
|
||
|
</v-text-field>
|
||
|
</div>
|
||
|
</v-col>
|
||
|
<v-col cols="12" class="py-0 px-5" style="width: 100%;height: calc(100% - 52px)">
|
||
3 years ago
|
<iframe
|
||
|
id="foo"
|
||
|
ref="webview"
|
||
|
v-shortkey="['ctrl','shift','w']"
|
||
|
class="white"
|
||
|
:src="webViewUrl"
|
||
|
style="width: 100%;height: 100%"
|
||
|
@shortkey="test"
|
||
|
/>
|
||
4 years ago
|
</v-col>
|
||
|
</v-row>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
3 years ago
|
name: 'GraphqlClient',
|
||
3 years ago
|
data() {
|
||
4 years ago
|
return {
|
||
|
url: '',
|
||
|
webViewUrl: ''
|
||
|
}
|
||
|
},
|
||
3 years ago
|
async created() {
|
||
3 years ago
|
if (this.$store.state.graphqlClient.list && this.$store.state.graphqlClient.list[0]) { this.webViewUrl = this.url = this.$store.state.graphqlClient.list[0].url }
|
||
4 years ago
|
try {
|
||
3 years ago
|
const { info } = (await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, {
|
||
4 years ago
|
headers: {
|
||
|
'xc-auth': this.$store.state.users.token
|
||
|
}
|
||
3 years ago
|
})).data
|
||
|
const gql = Object.values(info).find(v => v.gqlApiUrl)
|
||
4 years ago
|
if (gql) {
|
||
|
this.webViewUrl = this.url = gql.gqlApiUrl
|
||
|
}
|
||
|
} catch (e) {
|
||
|
}
|
||
|
},
|
||
3 years ago
|
mounted() {
|
||
4 years ago
|
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
test() {
|
||
3 years ago
|
console.log('triggerd')
|
||
|
},
|
||
3 years ago
|
loadUrl() {
|
||
3 years ago
|
this.webViewUrl = this.url
|
||
|
if (this.url) { this.$store.commit('graphqlClient/MutListAdd', { url: this.url }) }
|
||
|
}
|
||
4 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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|