Browse Source

refactor: code refactoring

Signed-off-by: Pranav C Balan <pranavxc@gmail.com>
pull/223/head
Pranav C Balan 3 years ago
parent
commit
54e22d212e
  1. 38
      packages/nc-gui/components/createOrEditProject.vue
  2. 4
      packages/nc-gui/components/project/settings/appearance.vue
  3. 183
      packages/nc-gui/store/sqlMgr.js

38
packages/nc-gui/components/createOrEditProject.vue

@ -9,8 +9,6 @@
v-model="valid">
<v-card class="elevation-5"
ref="mainCard">
<div
v-if="!edit"
style="position: absolute;top:-30px;
@ -440,30 +438,34 @@
</v-select>
<v-row class="pa-0 ma-0">
<input type="file" ref="certFilePath" class="d-none"/>
<x-btn tooltip="Select .cert file"
small
color="primary"
outlined
@click="selectFile(db,'ssl', 'certFilePath')"
@click="selectFile(db,'ssl', 'certFilePath',dbIndex)"
class="elevation-5"
v-ge="['project','env-db-cert']"
>{{ db.ui.ssl.cert }}
</x-btn>
<input type="file" ref="keyFilePath" class="d-none"/>
<x-btn tooltip="Select .key file"
small
color="primary"
outlined
@click="selectFile(db,'ssl', 'keyFilePath')"
@click="selectFile(db,'ssl', 'keyFilePath',dbIndex)"
v-ge="['project','env-db-key']"
class="elevation-5"
>{{ db.ui.ssl.key }}
</x-btn>
<input type="file" ref="caFilePath" class="d-none"/>
<x-btn tooltip="Select CA file"
small
color="primary"
outlined
@click="selectFile(db,'ssl', 'caFilePath')"
@click="selectFile(db,'ssl', 'caFilePath',dbIndex)"
v-ge="['project','env-db-ca']"
>{{ db.ui.ssl.ca }}
</x-btn>
@ -1208,19 +1210,21 @@ export default {
// shell.openItem(path.join(this.project.folder, 'config.xc.json'));
},
selectFile(db, obj, key) {
selectFile(db, obj, key, index) {
// this.$refs[key][index].click()
// console.log(obj, key);
const file = dialog.showOpenDialog({
properties: ["openFile"]
});
console.log(typeof file, file, typeof file[0]);
if (file && file[0]) {
let fileName = path.basename(file[0]);
db.ui[obj][key] = fileName;
Vue.set(db.ui[obj], key, fileName)
//db.connection[obj][key] = file[0].toString();
Vue.set(db.connection[obj], key, file[0].toString())
}
// const file = dialog.showOpenDialog({
// properties: ["openFile"]
// });
// console.log(typeof file, file, typeof file[0]);
// if (file && file[0]) {
// let fileName = path.basename(file[0]);
// db.ui[obj][key] = fileName;
// Vue.set(db.ui[obj], key, fileName)
// //db.connection[obj][key] = file[0].toString();
// Vue.set(db.connection[obj], key, file[0].toString())
// }
},
onPanelToggle(panelIndex, envKey) {
this.$nextTick(() => {

4
packages/nc-gui/components/project/settings/appearance.vue

@ -24,7 +24,7 @@
</v-tooltip>
</td>
</tr>
<tr>
<!--<tr>
<td>Show metatables</td>
<td>
<v-tooltip bottom>
@ -37,7 +37,7 @@
Show/hide metatables
</v-tooltip>
</td>
</tr>
</tr>-->
<tr>
<td>Show Screensaver</td>
<td>

183
packages/nc-gui/store/sqlMgr.js

@ -440,189 +440,6 @@ export const actions = {
};
//
// class SqlMgr {
//
// constructor(store) {
// this.$axios = axios.create({
// baseURL: 'http://localhost:8080',
// });
// this.store = store;
// }
//
//
// get token() {
// // return this.store.rootGetters['users/GtrToken']
// }
//
// async projectOpen() {
// // setInterval(async () => console.log('token', await this.store.dispatch('ActGetToken')), 1000);
// // await new Promise(resolve => setTimeout(resolve, 500))
// // console.log(await this.store.dispatch('ActGetToken'))
// // return (await this.$axios.post('/xc?q=projectOpen', {api: 'PROJECT_READ_BY_WEB'}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async sqlOp(args, api, opArgs) {
// // try {
// // return (await this.$axios.post('/xc?q=sqlOp_' + api, {api, ...args, args: opArgs}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// // } catch (e) {
// // throw new Error(e.response.data.msg);
// // }
// }
//
// async sqlOpPlus(args, api, opArgs) {
// // try {
// // return (await this.$axios.post('/xc?q=sqlOpPlus_' + api, {api, ...args, args: opArgs, sqlOpPlus: true}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// // } catch (e) {
// // throw new Error(e.response.data.msg);
// // }
// }
//
// async projectGenerateBackend(opArgs) {
// // return (await this.$axios.post('/xc?q=projectGenerateBackend', {api: 'projectGenerateBackend', args: opArgs}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async projectGenerateBackendGql(opArgs) {
// // return (await this.$axios.post('/xc?q=projectGenerateBackendGql', {
// // api: 'projectGenerateBackendGql',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async projectGetTsPolicyPath(opArgs) {
// // return (await this.$axios.post('/xc?q=projectGetTsPolicyPath', {api: 'projectGetTsPolicyPath', args: opArgs}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
//
// async projectGetGqlPolicyPath(opArgs) {
// // return (await this.$axios.post('/xc?q=projectGetGqlPolicyPath', {
// // api: 'projectGetGqlPolicyPath',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
//
// async projectGetPolicyPath(opArgs) {
// // return (await this.$axios.post('/xc?q=projectGetPolicyPath', {api: 'projectGetPolicyPath', args: opArgs}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
//
// async xcRoutesPolicyGet(opArgs) {
// // return (await this.$axios.post('/xc?q=xcRoutesPolicyGet', {
// // api: 'xcRoutesPolicyGet',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async projectGetGrpcPolicyFromDb(opArgs) {
// // return (await this.$axios.post('/xc?q=projectGetGrpcPolicyFromDb', {
// // api: 'projectGetGrpcPolicyFromDb',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async xcRpcPolicyUpdate(opArgs) {
// // return (await this.$axios.post('/xc?q=xcRpcPolicyUpdate', {
// // api: 'xcRpcPolicyUpdate',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async xcRoutesPolicyUpdate(opArgs) {
// // return (await this.$axios.post('/xc?q=xcRoutesPolicyUpdate', {
// // api: 'xcRoutesPolicyUpdate',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async xcResolverPolicyGet(opArgs) {
// // return (await this.$axios.post('/xc?q=xcResolverPolicyGet', {
// // api: 'xcResolverPolicyGet',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async xcResolverPolicyUpdate(opArgs) {
// // return (await this.$axios.post('/xc?q=xcResolverPolicyUpdate', {
// // api: 'xcResolverPolicyUpdate',
// // args: opArgs
// // }, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async importFresh(opArgs) {
// // return (await this.$axios.post('/xc?q=importFresh', {api: 'importFresh', args: opArgs}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
// async writeFile(opArgs) {
// // return (await this.$axios.post('/xc?q=writeFile', {api: 'writeFile', args: opArgs}, {
// // headers: {
// // 'xc-auth': await this.store.dispatch('ActGetToken')
// // }
// // })).data;
// }
//
//
// }
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

Loading…
Cancel
Save