Skip to content

Commit 2a6bd6b

Browse files
committed
1 parent de5d917 commit 2a6bd6b

File tree

12 files changed

+172
-115
lines changed

12 files changed

+172
-115
lines changed

src/main/kotlin/com/github/mgramin/sqlboot/model/connection/Endpoint.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ interface Endpoint {
4242

4343
fun properties(): Map<String, Any>
4444

45+
fun confDir(): String
46+
4547
@Deprecated("Move to SQLResourceType")
4648
fun getDataSource(): DataSource
4749

src/main/kotlin/com/github/mgramin/sqlboot/model/connection/FakeEndpoint.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,8 @@ class FakeEndpoint : Endpoint {
5050
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
5151
}
5252

53+
override fun confDir(): String {
54+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
55+
}
56+
5357
}

src/main/kotlin/com/github/mgramin/sqlboot/model/connection/SimpleEndpoint.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ import org.apache.tomcat.jdbc.pool.DataSource
4343
open class SimpleEndpoint(
4444
var name: String? = null,
4545
var host: String? = null,
46+
var confDir: String? = null,
4647
var properties: Map<String, Any>? = null
4748
) : Endpoint {
4849

4950
override fun name() = name!!
5051

5152
override fun host() = host!!
5253

54+
override fun confDir() = confDir!!
55+
5356
override fun properties(): Map<String, Any> = properties!!
5457

5558
private var dataSource: DataSource? = null

src/main/kotlin/com/github/mgramin/sqlboot/model/resourcetype/impl/FsResourceType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class FsResourceType(
7878
fun resourceTypes() = resourceTypes
7979

8080
private val resourceTypes: List<ResourceType> =
81-
walk(FileSystemResource(endpoints.first().properties()["fs_base_folder"].toString()).file.path)
81+
walk(FileSystemResource(endpoints.first().confDir()).file.path)
8282

8383
private fun walk(path: String) =
8484
File(path)

src/main/malewicz/src/components/CodeViewComponent.vue

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
2-
<v-dialog v-model="show" width="1200">
3-
<template v-slot:activator="{ on }">
4-
<v-btn icon v-on="on">
5-
<v-icon>build</v-icon>
6-
</v-btn>
7-
</template>
8-
<v-card>
9-
<v-card-title class="headline grey lighten-2" primary-title>SQL-query</v-card-title>
10-
<v-card-text>
11-
<pre v-highlightjs="meta.query" class="text-sm-left"><code class="sql"></code></pre>
12-
</v-card-text>
13-
<v-divider></v-divider>
14-
<v-card-actions>
15-
<v-spacer></v-spacer>
16-
<v-btn color="primary" flat @click="show = false">Close</v-btn>
17-
</v-card-actions>
18-
</v-card>
19-
</v-dialog>
2+
<v-dialog v-model="show" width="1200">
3+
<template v-slot:activator="{ on }">
4+
<v-btn icon v-on="on">
5+
<v-icon>build</v-icon>
6+
</v-btn>
7+
</template>
8+
<v-card>
9+
<v-card-title class="headline grey lighten-2" primary-title>SQL-query</v-card-title>
10+
<v-card-text>
11+
<pre v-highlightjs="meta.query" class="text-sm-left"><code class="sql"></code></pre>
12+
</v-card-text>
13+
<v-divider></v-divider>
14+
<v-card-actions>
15+
<v-spacer></v-spacer>
16+
<v-btn color="primary" flat @click="show = false">Close</v-btn>
17+
</v-card-actions>
18+
</v-card>
19+
</v-dialog>
2020
</template>
2121
<script>
2222
export default {
2323
name: 'CodeViewComponent',
24+
data () {
25+
return {
26+
show: false
27+
}
28+
},
2429
props: {
25-
show: {},
2630
meta: {}
2731
}
2832
}

src/main/malewicz/src/components/ColumnsComponent.vue

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
2-
<v-dialog v-model="show" width="1000">
3-
<template v-slot:activator="{ on }">
4-
<v-btn icon v-on="on">
5-
<v-icon>settings</v-icon>
6-
</v-btn>
2+
<v-dialog v-model="show" width="1000">
3+
<template v-slot:activator="{ on }">
4+
<v-btn icon v-on="on">
5+
<v-icon>settings</v-icon>
6+
</v-btn>
7+
</template>
8+
<v-card>
9+
<v-card-title class="headline grey lighten-2" primary-title>Columns</v-card-title>
10+
<v-card-text>
11+
<template>
12+
<v-data-table :items="meta.metadata" class="elevation-1" hide-actions>
13+
<template v-slot:headers="props">
14+
<tr>
15+
<th>Visible</th>
16+
<th>Name</th>
17+
<th>Description</th>
18+
</tr>
19+
</template>
20+
<template v-slot:items="props">
21+
<td>
22+
<v-checkbox v-model="props.item.properties.visible"/>
23+
</td>
24+
<td>{{ props.item.properties.label }}</td>
25+
<td>{{ props.item.properties.description }}</td>
26+
</template>
27+
</v-data-table>
728
</template>
8-
<v-card>
9-
<v-card-title class="headline grey lighten-2" primary-title>Columns</v-card-title>
10-
<v-card-text>
11-
<template>
12-
<v-data-table :items="meta.metadata" class="elevation-1" hide-actions>
13-
<template v-slot:headers="props">
14-
<tr>
15-
<th>Visible</th>
16-
<th>Name</th>
17-
<th>Description</th>
18-
</tr>
19-
</template>
20-
<template v-slot:items="props">
21-
<td>
22-
<v-checkbox v-model="props.item.properties.visible"/>
23-
</td>
24-
<td>{{ props.item.properties.label }}</td>
25-
<td>{{ props.item.properties.description }}</td>
26-
</template>
27-
</v-data-table>
28-
</template>
29-
</v-card-text>
30-
<v-divider></v-divider>
31-
<v-card-actions>
32-
<v-spacer></v-spacer>
33-
<v-btn color="primary" flat @click="show = false">Close</v-btn>
34-
</v-card-actions>
35-
</v-card>
36-
</v-dialog>
29+
</v-card-text>
30+
<v-divider></v-divider>
31+
<v-card-actions>
32+
<v-spacer></v-spacer>
33+
<v-btn color="primary" flat @click="show = false">Close</v-btn>
34+
</v-card-actions>
35+
</v-card>
36+
</v-dialog>
3737
</template>
3838
<script>
3939
export default {

src/main/malewicz/src/components/FilterComponent.vue

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
22
<v-dialog v-model="show" width="600">
3+
{{localFilter}}
34
<template v-slot:activator="{ on }">
45
<v-btn icon v-on="on">
56
<v-icon>search</v-icon>
@@ -11,15 +12,16 @@
1112
<template>
1213
<v-form ref="form">
1314
<span v-for="item in meta.metadata" v-bind:key="item.name">
15+
<span v-if="item.name === 'endpoint'"></span>
1416
<span v-if="item.properties.datatype === 'time'"></span>
1517
<v-combobox v-if="item.properties.values"
16-
v-model='selected[item.name]'
18+
v-model='localFilter[item.name]'
1719
:label="item.properties.label"
1820
:items="item.properties.values"
1921
clearable>
2022
</v-combobox>
2123
<v-text-field v-else
22-
v-model='selected[item.name]'
24+
v-model='localFilter[item.name]'
2325
:label="item.properties.label"
2426
clearable
2527
filled>
@@ -40,18 +42,38 @@
4042
<script>
4143
export default {
4244
name: 'FilterComponent',
43-
data () {
45+
data: function () {
4446
return {
4547
show: false,
46-
selected: {}
48+
localFilter: {}
4749
}
4850
},
4951
props: {
5052
meta: {}
5153
},
5254
methods: {
5355
setFilter () {
54-
this.$store.commit('setFilter', this.selected)
56+
for (const propName in this.$data.localFilter) {
57+
if (this.$data.localFilter[propName] === null || this.$data.localFilter[propName] === undefined) {
58+
delete this.$data.localFilter[propName]
59+
}
60+
}
61+
this.$store.commit('setFilter', this.$data.localFilter)
62+
}
63+
},
64+
computed: {
65+
stateFilter () {
66+
return this.$store.getters.getFilter
67+
}
68+
},
69+
watch: {
70+
stateFilter: {
71+
handler (newVal) {
72+
if (newVal.uri && Object.entries(newVal.uri).length === 0 && newVal.uri.constructor === Object) {
73+
this.$data.localFilter = {}
74+
}
75+
},
76+
deep: true
5577
}
5678
}
5779
}

src/main/malewicz/src/components/HelloWorld.vue

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
<template>
22

3-
<v-app id="inspire">
4-
5-
<v-toolbar color="green" dark fixed app clipped-right>
6-
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
7-
</v-toolbar>
8-
9-
<v-navigation-drawer fixed v-model="drawer" app>
10-
<ConnectionsListPanel/>
11-
<TypesListPanel/>
12-
</v-navigation-drawer>
13-
14-
<v-content>
15-
<component v-bind:is="panel"></component>
16-
</v-content>
17-
18-
<v-footer color="green" class="white--text" app>
19-
<span class="pa-3">CrocInc/sql-boot</span>
20-
<v-spacer></v-spacer>
21-
<span class="pa-3">&copy; 2019</span>
22-
</v-footer>
23-
</v-app>
3+
<v-app id="inspire">
4+
5+
<v-toolbar color="green" dark fixed app clipped-right>
6+
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
7+
</v-toolbar>
8+
9+
<v-navigation-drawer fixed v-model="drawer" app>
10+
<ConnectionsListPanel/>
11+
<TypesListPanel/>
12+
</v-navigation-drawer>
13+
14+
<v-content>
15+
<component v-bind:is="panel"></component>
16+
</v-content>
17+
18+
<v-footer color="green" class="white--text" app>
19+
<span class="pa-3">CrocInc/sql-boot</span>
20+
<v-spacer></v-spacer>
21+
<span class="pa-3">&copy; 2019</span>
22+
</v-footer>
23+
</v-app>
2424

2525
</template>
2626

src/main/malewicz/src/components/TypesListPanel.vue

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@
77

88
<v-list two-line>
99
<div v-for="tag in allTags()" v-bind:key="tag">
10-
<v-list-group v-if="typesByTag(tag).length > 0" prepend-icon="bookmark_border">
11-
<template v-slot:activator>
12-
<v-list-tile>
13-
<v-list-tile-title>{{tag}}</v-list-tile-title>
14-
</v-list-tile>
15-
</template>
16-
17-
<v-tooltip right v-for="item in typesByTag(tag)" :key="item.name">
18-
<template v-slot:activator="{ on }">
19-
<v-list-tile v-on="on" @click="setType(item.name)" v-if="item.properties.title">
20-
<v-list-tile-avatar>
21-
<v-icon v-bind:class="item.properties.icon_class">{{ item.properties.icon || "not_interested" }}</v-icon>
22-
</v-list-tile-avatar>
23-
<v-list-tile-content>{{ item.properties.title }}</v-list-tile-content>
10+
<v-list-group v-if="typesByTag(tag).length > 0" prepend-icon="bookmark_border">
11+
<template v-slot:activator>
12+
<v-list-tile>
13+
<v-list-tile-title>{{tag}}</v-list-tile-title>
2414
</v-list-tile>
2515
</template>
26-
<span v-if="item.properties.description">{{ item.properties.description }}</span>
27-
<span v-else>{{ item.properties.title }}</span>
28-
</v-tooltip>
29-
</v-list-group>
16+
17+
<v-tooltip right v-for="item in typesByTag(tag)" :key="item.name">
18+
<template v-slot:activator="{ on }">
19+
<v-list-tile v-on="on" @click="setType(item.name)" v-if="item.properties.title">
20+
<v-list-tile-avatar>
21+
<v-icon v-bind:class="item.properties.icon_class">{{ item.properties.icon || 'not_interested' }}
22+
</v-icon>
23+
</v-list-tile-avatar>
24+
<v-list-tile-content>{{ item.properties.title }}</v-list-tile-content>
25+
</v-list-tile>
26+
</template>
27+
<span v-if="item.properties.description">{{ item.properties.description }}</span>
28+
<span v-else>{{ item.properties.title }}</span>
29+
</v-tooltip>
30+
</v-list-group>
3031
</div>
3132
</v-list>
3233

@@ -42,17 +43,23 @@ export default {
4243
methods: {
4344
allTags () {
4445
return this.$store.getters.getTypes
45-
.map(v => { return v.properties.tags })
46+
.map(v => {
47+
return v.properties.tags
48+
})
4649
.filter(el => el === 0 || Boolean(el))
47-
.map(v => { return v.split(',') })
50+
.map(v => {
51+
return v.split(',')
52+
})
4853
.flatMap(v => v)
4954
.filter(this.onlyUnique)
5055
.filter(el => el !== 'ui')
5156
},
5257
typesByTag (tag) {
5358
return this.$store.getters.getTypes
5459
.filter(el => el === 0 || Boolean(el.properties.tags))
55-
.filter(v => { return v.properties.tags.includes(tag) && v.properties.tags.includes('ui') })
60+
.filter(v => {
61+
return v.properties.tags.includes(tag) && v.properties.tags.includes('ui')
62+
})
5663
},
5764
onlyUnique (value, index, self) {
5865
return self.indexOf(value) === index

0 commit comments

Comments
 (0)