Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DBRepo
Manage
Activity
Members
Labels
Plan
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FAIR Data Austria DB Repository
DBRepo
Commits
58a8f420
Verified
Commit
58a8f420
authored
3 years ago
by
Kirill Stytsenko
Browse files
Options
Downloads
Patches
Plain Diff
Clean-up QueryBuilder UI
parent
a02edd4e
No related branches found
No related tags found
3 merge requests
!81
New stable release
,
!43
Merge dev to master
,
!41
UI March
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fda-ui/components/query/Builder.vue
+34
-14
34 additions, 14 deletions
fda-ui/components/query/Builder.vue
with
34 additions
and
14 deletions
fda-ui/components/query/Builder.vue
+
34
−
14
View file @
58a8f420
<
template
>
<div>
<v-form
ref=
"form"
v-model=
"valid"
lazy-validation
>
<v-form
ref=
"form"
>
<v-toolbar
flat
>
<v-toolbar-title>
Create Query
</v-toolbar-title>
<v-spacer
/>
...
...
@@ -23,7 +20,6 @@
<v-col
cols=
"6"
>
<v-select
v-model=
"table"
:rules=
"[rules.required]"
:items=
"tables"
item-text=
"name"
return-object
...
...
@@ -33,7 +29,6 @@
<v-col
cols=
"6"
>
<v-select
v-model=
"select"
:rules=
"[rules.required]"
item-text=
"name"
:disabled=
"!table"
:items=
"selectItems"
...
...
@@ -52,14 +47,15 @@
<highlightjs
autodetect
:code=
"query.formatted"
/>
</v-col>
</v-row>
<v-row>
<v-row
v-if=
"queryId"
>
<v-col>
<p>
Results
</p>
<v-data-table
:headers=
"result.headers"
:items=
"result.rows"
:loading=
"loading"
:items-per-page=
"30"
:options.sync=
"options"
:server-items-length=
"total"
class=
"elevation-1"
/>
</v-col>
</v-row>
...
...
@@ -82,7 +78,6 @@ import _ from 'lodash'
export
default
{
data
()
{
return
{
valid
:
false
,
table
:
null
,
tables
:
[],
tableDetails
:
null
,
...
...
@@ -90,15 +85,17 @@ export default {
query
:
{
sql
:
''
},
options
:
{
page
:
1
,
itemsPerPage
:
10
},
select
:
[],
clauses
:
[],
result
:
{
headers
:
[],
rows
:
[]
},
rules
:
{
required
:
value
=>
!!
value
||
'
Required
'
},
total
:
0
,
loading
:
false
}
},
...
...
@@ -124,6 +121,10 @@ export default {
return
null
}
return
{
Authorization
:
`Bearer
${
this
.
token
}
`
}
},
valid
()
{
// we need to have at least one column selected
return
this
.
select
.
length
}
},
watch
:
{
...
...
@@ -131,7 +132,22 @@ export default {
deep
:
true
,
handler
()
{
this
.
buildQuery
()
this
.
queryId
=
null
}
},
options
(
newVal
,
oldVal
)
{
if
(
typeof
oldVal
.
groupBy
===
'
undefined
'
)
{
// initially, options do not have the groupBy field.
// don't run the execute method twice, when a new query is created
return
}
this
.
execute
()
},
table
()
{
this
.
queryId
=
null
},
select
()
{
this
.
queryId
=
null
}
},
beforeMount
()
{
...
...
@@ -150,7 +166,6 @@ export default {
}
},
async
execute
()
{
this
.
$refs
.
form
.
validate
()
this
.
loading
=
true
try
{
const
data
=
{
...
...
@@ -161,7 +176,11 @@ export default {
})]
}
console
.
debug
(
'
send data
'
,
data
)
const
res
=
await
this
.
$axios
.
put
(
`/api/container/
${
this
.
$route
.
params
.
container_id
}
/database/
${
this
.
databaseId
}
/query`
,
data
,
{
const
urlParams
=
`page=
${
this
.
options
.
page
-
1
}
&size=
${
this
.
options
.
itemsPerPage
}
`
const
res
=
await
this
.
$axios
.
put
(
`/api/container/
${
this
.
$route
.
params
.
container_id
}
/database/
${
this
.
databaseId
}
/query
${
this
.
queryId
?
`/
${
this
.
queryId
}
`
:
''
}
?
${
urlParams
}
`
,
data
,
{
headers
:
this
.
headers
})
console
.
debug
(
'
query result
'
,
res
)
...
...
@@ -172,6 +191,7 @@ export default {
return
{
text
:
s
.
name
,
value
:
s
.
name
,
sortable
:
false
}
})
this
.
result
.
rows
=
res
.
data
.
result
this
.
total
=
res
.
data
.
resultNumber
}
catch
(
err
)
{
console
.
error
(
'
query execute
'
,
err
)
this
.
$toast
.
error
(
'
Could not execute query
'
)
...
...
This diff is collapsed.
Click to expand it.
Kirill Stytsenko
@stytsenkok39
mentioned in commit
09d6ce2e
·
3 years ago
mentioned in commit
09d6ce2e
mentioned in commit 09d6ce2ef2b29c83e6435c27bce24745440cd67a
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment