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>
|
||
2 years ago
|
<v-col cols="12" class="py-0 px-5" style="width: 100%; height: calc(100% - 52px)">
|
||
3 years ago
|
<iframe
|
||
|
id="foo"
|
||
|
ref="webview"
|
||
2 years ago
|
v-shortkey="['ctrl', 'shift', 'w']"
|
||
3 years ago
|
class="white"
|
||
|
:src="webViewUrl"
|
||
2 years ago
|
style="width: 100%; height: 100%"
|
||
3 years ago
|
@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: '',
|
||
2 years ago
|
webViewUrl: '',
|
||
|
};
|
||
4 years ago
|
},
|
||
3 years ago
|
async created() {
|
||
2 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 {
|
||
2 years ago
|
const { info } = (
|
||
|
await this.$axios.get(`/nc/${this.$route.params.project_id}/projectApiInfo`, {
|
||
|
headers: {
|
||
|
'xc-auth': this.$store.state.users.token,
|
||
|
},
|
||
|
})
|
||
|
).data;
|
||
|
const gql = Object.values(info).find(v => v.gqlApiUrl);
|
||
4 years ago
|
if (gql) {
|
||
2 years ago
|
this.webViewUrl = this.url = gql.gqlApiUrl;
|
||
4 years ago
|
}
|
||
2 years ago
|
} catch (e) {}
|
||
3 years ago
|
},
|
||
2 years ago
|
mounted() {},
|
||
3 years ago
|
methods: {
|
||
3 years ago
|
test() {
|
||
2 years ago
|
console.log('triggerd');
|
||
3 years ago
|
},
|
||
3 years ago
|
loadUrl() {
|
||
2 years ago
|
this.webViewUrl = this.url;
|
||
|
if (this.url) {
|
||
|
this.$store.commit('graphqlClient/MutListAdd', { url: this.url });
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
};
|
||
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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|