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
GitLab 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
33f28888
Commit
33f28888
authored
May 27, 2021
by
Kirill Stytsenko
Browse files
Options
Downloads
Patches
Plain Diff
QueryBuilder: Table & Columns
Former-commit-id:
e12f50d0
parent
97d80d9a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!23
Sprint results
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
fda-ui/components/QueryBuilder.vue
+57
-13
57 additions, 13 deletions
fda-ui/components/QueryBuilder.vue
fda-ui/components/TableList.vue
+1
-0
1 addition, 0 deletions
fda-ui/components/TableList.vue
with
58 additions
and
13 deletions
fda-ui/components/QueryBuilder.vue
+
57
−
13
View file @
33f28888
<
template
>
<div>
<div>
QB
</div>
<v-btn
@
click=
"buildQuery"
>
Build
</v-btn>
<br>
{{
query
.
table
}}
<br>
{{
query
.
statements
}}
<br>
<v-row
dense
>
<v-col
cols=
"6"
>
<v-select
v-model=
"table"
:items=
"tables"
item-text=
"name"
return-object
label=
"Table"
@
change=
"loadColumns"
/>
</v-col>
<v-col
cols=
"6"
>
<v-select
v-model=
"select"
item-text=
"name"
:disabled=
"!table"
:items=
"selectItems"
label=
"Columns"
return-object
multiple
@
change=
"buildQuery"
/>
</v-col>
</v-row>
{{
query
.
sql
}}
</div>
</
template
>
...
...
@@ -17,20 +30,38 @@
export
default
{
data
()
{
return
{
table
:
null
,
tables
:
[],
tableDetails
:
null
,
query
:
{},
table
:
'
MyTable
'
,
select
:
[],
clauses
:
[]
}
},
mounted
()
{
computed
:
{
selectItems
()
{
return
this
.
tableDetails
&&
this
.
tableDetails
.
columns
}
},
async
mounted
()
{
// XXX same as in TableList
try
{
const
res
=
await
this
.
$axios
.
get
(
`/api/tables/api/database/
${
this
.
$route
.
params
.
db_id
}
/table`
)
this
.
tables
=
res
.
data
}
catch
(
err
)
{
this
.
$toast
.
error
(
'
Could not list tables.
'
)
}
},
methods
:
{
async
buildQuery
()
{
if
(
!
this
.
table
)
{
return
}
const
url
=
'
/server-middleware/query/build
'
const
data
=
{
table
:
this
.
table
,
select
:
this
.
select
,
table
:
this
.
table
.
internalName
,
select
:
this
.
select
.
map
(
s
=>
s
.
name
)
,
clauses
:
this
.
clauses
}
try
{
...
...
@@ -41,10 +72,23 @@ export default {
}
catch
(
e
)
{
console
.
log
(
e
)
}
},
async
loadColumns
()
{
const
tableId
=
this
.
table
.
id
try
{
const
res
=
await
this
.
$axios
.
get
(
`/api/tables/api/database/
${
this
.
$route
.
params
.
db_id
}
/table/
${
tableId
}
`
)
this
.
tableDetails
=
res
.
data
this
.
buildQuery
()
}
catch
(
err
)
{
this
.
$toast
.
error
(
'
Could not get table details.
'
)
}
}
}
}
</
script
>
<
style
scoped
>
/* .select {
width: 200px;
} */
</
style
>
This diff is collapsed.
Click to expand it.
fda-ui/components/TableList.vue
+
1
−
0
View file @
33f28888
...
...
@@ -103,6 +103,7 @@ export default {
},
methods
:
{
async
refresh
()
{
// XXX same as in QueryBuilder
let
res
try
{
res
=
await
this
.
$axios
.
get
(
...
...
This diff is collapsed.
Click to expand it.
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