Additions

This commit is contained in:
Fabio 2020-05-07 17:45:04 +02:00
parent d1b83fd148
commit 7b4c55dd62
13 changed files with 164 additions and 65 deletions

View File

@ -1,3 +1,4 @@
/node_modules /node_modules
/assets/vendor /assets/vendor
/out /out
/dist

View File

@ -9,7 +9,8 @@
"plugin:vue/recommended" "plugin:vue/recommended"
], ],
"parserOptions": { "parserOptions": {
"ecmaVersion": 2017, "parser": "babel-eslint",
"ecmaVersion": 9,
"sourceType": "module" "sourceType": "module"
}, },
"rules": { "rules": {
@ -40,9 +41,6 @@
], ],
"no-console": "off", "no-console": "off",
"no-undef": "off", "no-undef": "off",
"plugins": [
"vue"
],
"vue/no-side-effects-in-computed-properties": "off", "vue/no-side-effects-in-computed-properties": "off",
"vue/require-default-prop": "off", "vue/require-default-prop": "off",
"vue/no-v-html": "off", "vue/no-v-html": "off",

24
package-lock.json generated
View File

@ -1901,6 +1901,20 @@
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==",
"dev": true "dev": true
}, },
"babel-eslint": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz",
"integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
"@babel/parser": "^7.7.0",
"@babel/traverse": "^7.7.0",
"@babel/types": "^7.7.0",
"eslint-visitor-keys": "^1.0.0",
"resolve": "^1.12.0"
}
},
"babel-loader": { "babel-loader": {
"version": "8.1.0", "version": "8.1.0",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.1.0.tgz", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.1.0.tgz",
@ -2832,6 +2846,11 @@
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true "dev": true
}, },
"codemirror": {
"version": "5.53.2",
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.53.2.tgz",
"integrity": "sha512-wvSQKS4E+P8Fxn/AQ+tQtJnF1qH5UOlxtugFLpubEZ5jcdH2iXTVinb+Xc/4QjshuOxRm4fUsU2QPF1JJKiyXA=="
},
"collection-visit": { "collection-visit": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
@ -7777,6 +7796,11 @@
"escape-string-regexp": "^2.0.0" "escape-string-regexp": "^2.0.0"
} }
}, },
"material-design-icons": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/material-design-icons/-/material-design-icons-3.0.1.tgz",
"integrity": "sha1-mnHEh0chjrylHlGmbaaCA4zct78="
},
"md5.js": { "md5.js": {
"version": "1.3.5", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",

View File

@ -17,10 +17,19 @@
"static/*" "static/*"
] ]
}, },
"electronWebpack": {}, "electronWebpack": {
"whiteListedModules": [
"codemirror"
],
"renderer": {
"webpackConfig": "webpack.config.js"
}
},
"dependencies": { "dependencies": {
"codemirror": "^5.53.2",
"devicons": "^1.8.0", "devicons": "^1.8.0",
"knex": "^0.21.1", "knex": "^0.21.1",
"material-design-icons": "^3.0.1",
"source-map-support": "^0.5.16", "source-map-support": "^0.5.16",
"vue-i18n": "^8.17.4", "vue-i18n": "^8.17.4",
"vue-router": "^3.1.6", "vue-router": "^3.1.6",
@ -34,6 +43,7 @@
"electron-webpack": "^2.8.2", "electron-webpack": "^2.8.2",
"electron-webpack-vue": "^2.4.0", "electron-webpack-vue": "^2.4.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"babel-eslint": "^10.1.0",
"eslint-config-standard": "^14.1.1", "eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.20.1", "eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",

View File

@ -15,6 +15,8 @@ function createMainWindow () {
const window = new BrowserWindow({ const window = new BrowserWindow({
width: 1024, width: 1024,
height: 800, height: 800,
title: 'Antares',
autoHideMenuBar: true,
icon: path.join(__static, 'logo-32.png'), icon: path.join(__static, 'logo-32.png'),
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: true,

View File

@ -1,32 +1,45 @@
<template> <template>
<div id="app"> <div id="wrapper">
<img alt="Vue logo" src="logo.png"> <!-- <TheHeader @toggleSidebar="toggleSidebar" /> -->
<HelloWorld :msg="$store.state.application.appName" /> <!-- <TheSidebar /> -->
<div id="main-content">
<!-- <BaseLoaderLayer
id="main-loader"
:is-loading="isLoading"
/> -->
<QueryEditor v-model="query" />
</div>
<!-- <TheFooter /> -->
</div> </div>
</template> </template>
<script> <script>
import HelloWorld from './components/HelloWorld.vue'; import QueryEditor from '@/components/QueryEditor';
export default { export default {
name: 'App', name: 'App',
components: { components: {
HelloWorld QueryEditor
},
data () {
return {
query: ''
};
},
computed: {
isLoading () {
return this.$store.state.application.isLoading;
}
},
methods: {
} }
}; };
</script> </script>
<style> <style>
body{ html,
background: #FFFFFF; body{
} height: 100%;
background: #fff;
#app { }
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style> </style>

View File

@ -1,41 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<div>
<i class="devicons devicons-mysql"></i>
<i class="devicons devicons-msql_server"></i>
<i class="devicons devicons-postgresql"></i>
</div>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.devicons{
font-size: 4rem;
}
</style>

View File

@ -0,0 +1,72 @@
<template>
<div class="editor-wrapper">
<textarea
ref="codemirror"
:options="cmOptions"
/>
</div>
</template>
<script>
import CodeMirror from 'codemirror';
import 'codemirror/lib/codemirror.css';
import 'codemirror/theme/material-darker.css';
import 'codemirror/mode/sql/sql';
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/selection/active-line';
import 'codemirror/addon/hint/show-hint';
import 'codemirror/addon/hint/show-hint.css';
import 'codemirror/addon/hint/sql-hint';
CodeMirror.defineOption('sql-hint');
export default {
name: 'QueryEditor',
props: {
value: String
},
data () {
return {
cminstance: null,
content: '',
cmOptions: {
tabSize: 3,
smartIndent: true,
styleActiveLine: true,
lineNumbers: true,
line: true,
mode: 'text/x-sql',
theme: 'material-darker',
extraKeys: {
'Ctrl-Space': 'autocomplete'
},
hintOptions: {
tables: {
users: ['name', 'score', 'birthDate'],
countries: ['name', 'population', 'size']
}
},
autoCloseBrackets: true
}
};
},
mounted () {
this.initialize();
},
methods: {
initialize () {
this.cminstance = CodeMirror.fromTextArea(this.$refs.codemirror, this.cmOptions);
this.cminstance.setValue(this.value || this.content);
this.cminstance.on('change', cm => {
this.content = cm.getValue();
this.$emit('input', this.content);
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -1,14 +1,19 @@
'use strict'; 'use strict';
import Vue from 'vue'; import Vue from 'vue';
import 'devicons/css/devicons.min.css'; import 'devicons/css/devicons.min.css';
import 'material-design-icons/iconfont/material-icons.css';
import '@/scss/main.scss';
import App from '@/App.vue'; import App from '@/App.vue';
import store from '@/store'; import store from '@/store';
import router from '@/routes';
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ new Vue({
render: h => h(App), render: h => h(App),
store store,
router
}).$mount('#app'); }).$mount('#app');

View File

@ -0,0 +1,10 @@
import Vue from 'vue';
import Router from 'vue-router';
Vue.use(Router);
const router = new Router({
routes: []
});
export default router;

View File

View File

@ -0,0 +1 @@
@import "variables";

4
webpack.config.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
plugins: [
]
};