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.
308 lines
10 KiB
308 lines
10 KiB
4 years ago
|
<template>
|
||
|
<v-container class="ma-0 pa-0" fluid>
|
||
|
<v-card class="text-center">
|
||
|
<v-col cols="10" offset="1" class="pa-10">
|
||
|
<div style="border: 1px solid grey">
|
||
|
<v-toolbar height="42" flat class="toolbar-border-bottom">
|
||
3 years ago
|
<v-breadcrumbs
|
||
3 years ago
|
:items="[
|
||
|
{
|
||
|
text: nodes.env,
|
||
|
disabled: true,
|
||
|
href: '#',
|
||
|
},
|
||
|
{
|
||
|
text: nodes.dbAlias,
|
||
|
disabled: true,
|
||
|
href: '#',
|
||
|
},
|
||
|
]"
|
||
3 years ago
|
divider=">"
|
||
|
small
|
||
|
>
|
||
|
<template #divider>
|
||
3 years ago
|
<v-icon small color="grey lighten-2"> forward </v-icon>
|
||
4 years ago
|
</template>
|
||
|
</v-breadcrumbs>
|
||
|
|
||
3 years ago
|
<v-spacer />
|
||
4 years ago
|
|
||
3 years ago
|
<v-btn small outlined color="success" :disabled="!!server1" @click="startServer">
|
||
4 years ago
|
<v-icon>mdi-play</v-icon>
|
||
|
Start API Server
|
||
|
</v-btn>
|
||
3 years ago
|
<v-btn small outlined color="error" :disabled="!server1" @click="stopServer">
|
||
4 years ago
|
<v-icon>mdi-stop</v-icon>
|
||
|
Stop API Server
|
||
|
</v-btn>
|
||
|
</v-toolbar>
|
||
|
<v-card class="elevation-1 pa-8 text-left">
|
||
|
<v-col cols="4" offset="4">
|
||
3 years ago
|
<v-text-field v-model="portNumber" :height="20" label="Port for webserver" autofocus />
|
||
4 years ago
|
</v-col>
|
||
|
|
||
|
<v-card v-if="server1" class="elevation-1 pa-4">
|
||
3 years ago
|
<p class="text-center display-1 pt-2">Generating APIs at the speed of your thought</p>
|
||
4 years ago
|
<!-- <v-divider></v-divider>-->
|
||
3 years ago
|
<br />
|
||
4 years ago
|
|
||
|
<v-simple-table class="text-center">
|
||
3 years ago
|
<template #default>
|
||
4 years ago
|
<tbody>
|
||
3 years ago
|
<tr>
|
||
|
<td>Total Tables in Database</td>
|
||
|
<td class="text-left">
|
||
|
{{ server1.tables }}
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>APIs generated</td>
|
||
|
<td class="text-left">
|
||
|
{{ server1.apis }}
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>Local URL</td>
|
||
|
<td class="text-left">
|
||
3 years ago
|
<a class="title" @click.prevent="openUrl(server1.localUrl)"> {{ server1.localUrl }}</a>
|
||
3 years ago
|
<v-btn
|
||
|
v-clipboard="`${server1.localUrl}/pwa`"
|
||
|
v-clipboard:success="clipboardSuccessHandler"
|
||
|
v-clipboard:error="clipboardErrorHandler"
|
||
|
small
|
||
|
text
|
||
|
>
|
||
|
<v-icon>mdi-content-copy</v-icon>
|
||
|
</v-btn>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>Cloud URL</td>
|
||
|
<td class="text-left">
|
||
|
<v-btn v-if="!server1.cloudUrl" outlined color="primary" @click.prevent="getCloudUrl()">
|
||
|
<v-icon>mdi-cloud-outline</v-icon>
|
||
|
Get Cloud URL
|
||
|
</v-btn>
|
||
|
<span v-else style="" class="title">
|
||
3 years ago
|
<a @click.prevent="openUrl(server1.cloudUrl)"> {{ server1.cloudUrl }}</a>
|
||
3 years ago
|
|
||
|
<v-btn
|
||
|
v-clipboard="server1.cloudUrl"
|
||
|
v-clipboard:success="clipboardSuccessHandler"
|
||
|
v-clipboard:error="clipboardErrorHandler"
|
||
|
small
|
||
|
text
|
||
3 years ago
|
><v-icon>mdi-content-copy</v-icon></v-btn
|
||
|
>
|
||
3 years ago
|
</span>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr v-if="server1.cloudUrl">
|
||
|
<td>Web App Url</td>
|
||
|
<td class="text-left">
|
||
3 years ago
|
<br />
|
||
|
<a class="title" @click.prevent="openWebUrl(server1.cloudUrl + '/pwa')">
|
||
3 years ago
|
{{ server1.cloudUrl }}/pwa
|
||
|
</a>
|
||
|
<v-btn
|
||
|
v-clipboard="`${server1.cloudUrl}/pwa`"
|
||
|
v-clipboard:success="clipboardSuccessHandler"
|
||
|
v-clipboard:error="clipboardErrorHandler"
|
||
|
small
|
||
|
text
|
||
|
>
|
||
|
<v-icon>mdi-content-copy</v-icon>
|
||
|
</v-btn>
|
||
3 years ago
|
<br />
|
||
|
<br />
|
||
3 years ago
|
|
||
3 years ago
|
<v-btn outlined color="primary" class="mb-4" @click.prevent="sendNotification()">
|
||
|
<v-icon>mdi-send</v-icon> Send Push Notification
|
||
3 years ago
|
</v-btn>
|
||
|
</td>
|
||
|
</tr>
|
||
4 years ago
|
</tbody>
|
||
|
</template>
|
||
|
</v-simple-table>
|
||
|
|
||
|
<!-- <p class="title">Total Tables : {{server1.tables}}</p>-->
|
||
|
<!-- <p class="title">APIs generated: {{server1.apis}}</p>-->
|
||
|
<!-- <p class="title">Local URL : <span style="color: lightskyblue;"><a-->
|
||
|
<!-- @click.prevent="openUrl(server1.localUrl)">-->
|
||
|
<!-- {{server1.localUrl}}</a></span>-->
|
||
|
<!-- </p>-->
|
||
|
|
||
|
<!-- <p class="title" v-if="!server1.cloudUrl">Cloud URL :-->
|
||
|
<!-- <v-btn @click.prevent="getCloudUrl()" class="primary">Get Cloud URL</v-btn>-->
|
||
|
<!-- </p>-->
|
||
|
<!-- <p v-else class="title">-->
|
||
|
<!-- <span style="">Cloud URL :-->
|
||
|
<!-- <a @click.prevent="openUrl(server1.cloudUrl)">-->
|
||
|
<!-- {{server1.cloudUrl}}</a>-->
|
||
|
<!-- </span>-->
|
||
|
<!-- </p>-->
|
||
|
</v-card>
|
||
|
</v-card>
|
||
|
</div>
|
||
|
</v-col>
|
||
|
</v-card>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { mapGetters, mapActions } from 'vuex';
|
||
4 years ago
|
|
||
3 years ago
|
export default {
|
||
|
components: {},
|
||
3 years ago
|
data() {
|
||
3 years ago
|
return {
|
||
|
// portNumber: 3000,
|
||
3 years ago
|
};
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
|
...mapGetters({
|
||
|
sqlMgr: 'sqlMgr/sqlMgr',
|
||
3 years ago
|
tabs: 'tabs/list',
|
||
3 years ago
|
}),
|
||
4 years ago
|
|
||
3 years ago
|
server1() {
|
||
3 years ago
|
return this.$store.state.apiServer.servers[this.nodes.key];
|
||
4 years ago
|
},
|
||
|
|
||
3 years ago
|
portNumber() {
|
||
3 years ago
|
return this.server1 ? this.server1.portNumber : 3000;
|
||
|
},
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
|
...mapActions({
|
||
3 years ago
|
changeActiveTab: 'tabs/changeActiveTab',
|
||
3 years ago
|
}),
|
||
4 years ago
|
|
||
3 years ago
|
openWebUrl(url) {
|
||
3 years ago
|
// shell.openExternal(url)
|
||
|
},
|
||
4 years ago
|
|
||
3 years ago
|
openUrl(url) {
|
||
3 years ago
|
const _nodes = { ...this.nodes };
|
||
|
_nodes.key = _nodes.dbKey + '.apiClient';
|
||
|
_nodes.type = 'apiClientDir';
|
||
|
_nodes.url = url;
|
||
|
const tabIndex = this.tabs.findIndex(el => el.key === _nodes.key);
|
||
3 years ago
|
if (tabIndex !== -1) {
|
||
3 years ago
|
this.changeActiveTab(tabIndex);
|
||
3 years ago
|
} else {
|
||
|
this.$store.dispatch('tabs/ActAddTab', {
|
||
|
name: 'API Client',
|
||
|
key: _nodes.key,
|
||
3 years ago
|
_nodes,
|
||
|
});
|
||
3 years ago
|
}
|
||
|
},
|
||
4 years ago
|
|
||
3 years ago
|
async startServer() {
|
||
3 years ago
|
try {
|
||
3 years ago
|
const args = { ...this.nodes };
|
||
|
args.portNumber = this.server1 ? this.server1.portNumber : 3000;
|
||
4 years ago
|
|
||
3 years ago
|
await this.$store.dispatch('apiServer/start', args);
|
||
4 years ago
|
|
||
3 years ago
|
this.$toast.success('API server started successfully', { duration: 1000 });
|
||
3 years ago
|
} catch (e) {
|
||
3 years ago
|
console.log(e);
|
||
|
throw e;
|
||
3 years ago
|
}
|
||
|
},
|
||
4 years ago
|
|
||
3 years ago
|
async stopServer() {
|
||
3 years ago
|
try {
|
||
3 years ago
|
const args = { ...this.nodes };
|
||
|
args.portNumber = parseInt(this.server1.portNumber);
|
||
4 years ago
|
|
||
3 years ago
|
await this.$store.dispatch('apiServer/stop', args);
|
||
4 years ago
|
|
||
3 years ago
|
this.$toast.success('API server stopped successfully', { duration: 1000 });
|
||
3 years ago
|
} catch (e) {
|
||
3 years ago
|
console.log(e);
|
||
|
throw e;
|
||
3 years ago
|
}
|
||
|
},
|
||
4 years ago
|
|
||
3 years ago
|
async getCloudUrl() {
|
||
3 years ago
|
try {
|
||
3 years ago
|
const args = { ...this.nodes };
|
||
|
args.portNumber = parseInt(this.server1.portNumber);
|
||
4 years ago
|
|
||
3 years ago
|
await this.$store.dispatch('apiServer/getCloudUrl', args);
|
||
4 years ago
|
|
||
3 years ago
|
this.$toast.success('Cloud URL received successfully', { duration: 1000 });
|
||
3 years ago
|
} catch (e) {
|
||
3 years ago
|
console.log(e);
|
||
|
throw e;
|
||
4 years ago
|
}
|
||
|
},
|
||
|
|
||
3 years ago
|
async sendNotification() {
|
||
3 years ago
|
try {
|
||
3 years ago
|
const args = { ...this.nodes };
|
||
|
await this.$store.dispatch('apiServer/cloudSendNotification', args);
|
||
3 years ago
|
// this.$toast.success('Cloud URL received successfully', {duration: 1000})
|
||
|
} catch (e) {
|
||
3 years ago
|
console.log(e);
|
||
|
throw e;
|
||
3 years ago
|
}
|
||
4 years ago
|
},
|
||
3 years ago
|
clipboardSuccessHandler({ value, event }) {
|
||
3 years ago
|
this.$toast.info('Copied to clipboard.').goAway(1000);
|
||
4 years ago
|
},
|
||
3 years ago
|
|
||
3 years ago
|
clipboardErrorHandler({ value, event }) {
|
||
3 years ago
|
this.$toast.info('Clipboard copying failed.').goAway(1000);
|
||
|
},
|
||
3 years ago
|
},
|
||
|
|
||
3 years ago
|
beforeCreated() {},
|
||
3 years ago
|
watch: {},
|
||
3 years ago
|
async created() {
|
||
3 years ago
|
// this.server.serverLive = await this.sqlMgr.projectAPIServerIsLive();
|
||
|
},
|
||
3 years ago
|
mounted() {},
|
||
|
beforeDestroy() {},
|
||
|
destroy() {},
|
||
3 years ago
|
directives: {},
|
||
3 years ago
|
validate({ params }) {
|
||
3 years ago
|
return true;
|
||
3 years ago
|
},
|
||
3 years ago
|
head() {
|
||
3 years ago
|
return {};
|
||
3 years ago
|
},
|
||
3 years ago
|
props: ['nodes'],
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
3 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/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|