Skip to content

Commit 995b1d3

Browse files
committed
Vuetify it #338
1 parent cd3c9ac commit 995b1d3

15 files changed

Lines changed: 247 additions & 269 deletions

File tree

conf/h2/md/database/instance/locks/locks.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
````sql
22
/*
3-
{ "name": "locks", "title": "Locks" }
3+
{
4+
"name": "locks",
5+
"title": "Locks",
6+
"icon": "lock"
7+
}
48
*/
59
select "@schema"
610
, "@table"

conf/h2/md/database/schema/table.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
````sql
22
/*
3-
{ "name": "table", "title": "Tables" }
3+
{
4+
"name": "table",
5+
"title": "Tables",
6+
"icon": "table_chart"
7+
}
48
*/
59
select "@schema" /* { "label": "Owner", "description": "Owner of the table", "visible": false } */
6-
, "@table" /* { "label": "Name", "description": "Name of the table", "visible": true } */
10+
, "@table" /* { "label": "Name", "description": "Name of the table" } */
711
, table_type /* { "label": "Type", "description": "Typical types", "visible": true, "values": ['TABLE', 'VIEW', 'SYSTEM TABLE', 'GLOBAL TEMPORARY', 'LOCAL TEMPORARY', 'ALIAS', 'SYNONYM'] } */
812
, remarks /* { "label": "Comment", "description": "Comments", "visible": true } */
913
, last_modification /* { "label": "Last modification", "description": "Last modification" } */
@@ -13,12 +17,15 @@ select "@schema" /* { "label": "Owner", "description": "Owner of the
1317
from information_schema.tables t
1418
where lower(t.table_schema) like lower('${uri.path(0)}')
1519
and lower(t.table_name) like lower('${uri.path(1)}'))
16-
order by "@schema", "@table"
1720
````
1821

1922
````sql
2023
/*
21-
{ "name": "column", "title": "Columns" }
24+
{
25+
"name": "column",
26+
"title": "Columns",
27+
"icon": "view_column"
28+
}
2229
*/
2330
select "@schema" /* { "label": "owner", "description": "Owner of the table", "visible": true } */
2431
, "@table" /* { "label": "table name", "description": "Name of the table", "visible": true } */
@@ -36,7 +43,11 @@ select "@schema" /* { "label": "owner", "description": "Owner o
3643

3744
````sql
3845
/*
39-
{ "name": "pk", "title": "Primary keys" }
46+
{
47+
"name": "pk",
48+
"title": "Primary keys",
49+
"icon": "vpn_key"
50+
}
4051
*/
4152
select "@schema" /* { "label": "owner", "description": "Owner of the table", "visible": true } */
4253
, "@table" /* { "label": "table name", "description": "Name of the table", "visible": true } */

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ data class Metadata(
5252
fun toJson(): JsonObject {
5353
val jsonObject = JsonObject()
5454
val toJson: JsonElement = Gson().toJsonTree(properties)
55-
jsonObject.addProperty("name", name.replace("@", ""))
55+
jsonObject.addProperty("name", name.replace("@", "").toLowerCase())
5656
jsonObject.addProperty("description", description)
57+
jsonObject.addProperty("value", name.replace("@", "").toLowerCase())
58+
jsonObject.addProperty("text", properties["label"]?.toString()?:name.replace("@", ""))
5759
jsonObject.add("properties", toJson)
5860
return jsonObject
5961
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SqlResourceType(
7777
?: connection.properties()["sql.dialect"].toString()).execute(hashMapOf("uri" to uri))
7878
.map<Map<String, Any>?> {
7979
val toMutableMap = it.toMutableMap()
80-
toMutableMap["database"] = connection.name()
80+
toMutableMap["endpoint"] = connection.name()
8181
toMutableMap
8282
}
8383
}
@@ -94,15 +94,15 @@ class SqlResourceType(
9494
} else {
9595
path[path.size - 1]
9696
}
97-
DbResourceImpl(name, this, DbUri(headers["database"].toString(), this.name(), path), headers) as DbResource
97+
DbResourceImpl(name, this, DbUri(headers["endpoint"].toString(), this.name(), path), headers) as DbResource
9898
}
9999
}
100100

101101
override fun metaData(uri: Uri): List<Metadata> =
102102
simpleSelectQuery
103103
.columns()
104104
.map { Metadata(it.key, it.value) } +
105-
Metadata("database", """{"label": "Database", "description": "Database name", "visible": false}""")
105+
Metadata("endpoint", """{"label": "Endpoint", "description": "Endpoint name", "visible": false}""")
106106

107107
override fun toJson(): JsonObject {
108108
val jsonObject = JsonObject()

src/main/kotlin/com/github/mgramin/sqlboot/model/resourcetype/wrappers/header/DbNameWrapper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DbNameWrapper(private val origin: ResourceType,
3838

3939
override fun path() = origin.path()
4040

41-
override fun metaData(uri: Uri): List<Metadata> = origin.metaData(uri) + Metadata("database", "Database name")
41+
override fun metaData(uri: Uri): List<Metadata> = origin.metaData(uri) + Metadata("endpoint", "Endpoint name")
4242

4343
override fun read(uri: Uri): Flux<DbResource> =
4444
origin

src/main/kotlin/com/github/mgramin/sqlboot/rest/controllers/ApiController.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,7 @@ class ApiController {
117117
.map { it.headers() }
118118
.collectList()
119119
.block()
120-
return if (headers.isEmpty()) {
121-
ResponseEntity(headers, HttpStatus.NO_CONTENT)
122-
} else {
123-
ResponseEntity(headers, HttpStatus.OK)
124-
}
120+
return ResponseEntity(headers, HttpStatus.OK)
125121
} catch (e: BootException) {
126122
if (e.errorCode == 404) {
127123
return ResponseEntity(emptyList(), HttpStatus.NOT_FOUND)

src/main/kotlin/com/github/mgramin/sqlboot/sql/select/wrappers/OrderedSelectQuery.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ class OrderedSelectQuery(
3636
override fun query(): String {
3737
if (orderedColumns.isEmpty()) return origin.query()
3838
val orderExpression = orderedColumns.map { "${it.key} ${it.value}" }.joinToString { it }
39-
return """select *
40-
| from (${origin.query()})
41-
| order by $orderExpression""".trimMargin()
39+
return """${origin.query()} order by $orderExpression"""
40+
// return """select *
41+
// | from (${origin.query()})
42+
// | order by $orderExpression""".trimMargin()
4243
}
4344

4445
override fun columns() = origin.columns()

src/main/malewicz/index.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width,initial-scale=1.0">
66

7-
<!-- Bootstrap CSS -->
8-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
7+
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
98

10-
<!-- Font Awesome -->
11-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
9+
<!-- Downloaded and saved in /static/css/highlight.css -->
10+
<link rel="stylesheet" href="/static/css/highlight.css">
11+
12+
<!-- Or if you want to use the stylesheet from the CDN -->
13+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/default.min.css">
1214

1315
<title>malewicz</title>
1416
</head>
1517
<body>
1618

1719
<div class="container">
1820
<h1>malewicz</h1>
19-
<h5>A hackable GUI SQL-manager written on SQL itself</h5>
20-
<div id="app"></div>
21+
<h4>A hackable GUI SQL-manager written on SQL itself</h4>
2122
</div>
22-
<!-- built files will be auto injected -->
23+
<div id="app"></div>
2324

2425
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
2526
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>

src/main/malewicz/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
"vue": "^2.5.17",
2222
"vue-echarts": "^4.0.1",
2323
"vue-echarts-v3": "^1.0.19",
24+
"vue-highlightjs": "^1.3.3",
2425
"vue-json-excel": "^0.2.98",
2526
"vue-notification": "^1.3.16",
2627
"vue-router": "^3.0.1",
2728
"vue-sse": "^1.0.2",
2829
"vue-tree-navigation": "^4.0.1",
30+
"vuetify": "^1.5.14",
2931
"vuex": "^3.0.1"
3032
},
3133
"devDependencies": {

src/main/malewicz/src/components/ChartPanel.vue

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)