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
Merge requests
!40
Misc
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Misc
ui-february
into
dev
Overview
0
Commits
7
Pipelines
0
Changes
18
Merged
Misc
Kirill Stytsenko
requested to merge
ui-february
into
dev
Feb 28, 2022
Overview
0
Commits
7
Pipelines
0
Changes
18
#131
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
f4f117af
7 commits,
Feb 28, 2022
18 files
+
213
−
80
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
18
fda-ui/components/dialogs/ColumnUnit.vue
+
122
−
33
View file @ f4f117af
Edit in single-file editor
Open in Web IDE
Show full file
@@ -4,10 +4,14 @@
@@ -4,10 +4,14 @@
max-width=
"600px"
>
max-width=
"600px"
>
<template
v-slot:activator=
"
{ on, attrs }">
<template
v-slot:activator=
"
{ on, attrs }">
<v-btn
<v-btn
class=
"ml-2"
icon
small
small
v-bind=
"attrs"
v-bind=
"attrs"
v-on=
"on"
>
v-on=
"on"
>
Unit
<v-icon>
mdi-pencil-outline
</v-icon>
</v-btn>
</v-btn>
</
template
>
</
template
>
<v-card>
<v-card>
@@ -15,16 +19,57 @@
@@ -15,16 +19,57 @@
<span
class=
"text-h5"
>
Column Unit
</span>
<span
class=
"text-h5"
>
Column Unit
</span>
</v-card-title>
</v-card-title>
<v-card-text>
<v-card-text>
<div>
<i>
Autocomplete not working yet
</i>
</div>
<v-autocomplete
<v-autocomplete
v-model=
"model"
solo
clearable
auto-select-first
:cache-items=
"false"
autofocus
:search-input.sync=
"search"
:items=
"items"
hide-no-data
hide-details
hide-details
dense
dense
>
clearable
/>
<
template
v-slot:item=
"{ item, attrs, on }"
>
<v-list-item
v-bind=
"attrs"
v-on=
"on"
>
<v-list-item-content>
<v-list-item-title>
{{
item
.
value
.
name
}}
</v-list-item-title>
<v-list-item-subtitle>
{{
item
.
value
.
comment
}}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</
template
>
</v-autocomplete>
</v-card-text>
</v-card-text>
<v-expand-transition>
<v-list
v-if=
"model"
class=
"lighten-3"
subheader
three-line
>
<v-list-item>
<v-list-item-content>
<v-list-item-title>
Name
</v-list-item-title>
<v-list-item-subtitle>
{{ model.name }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-list-item-title>
Symbol
</v-list-item-title>
<v-list-item-subtitle>
{{ model.symbol }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-list-item-title>
Comment
</v-list-item-title>
<v-list-item-subtitle>
{{ model.comment }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item
v-if=
"uri"
three-line
>
<v-list-item-content>
<v-list-item-title>
URI
</v-list-item-title>
<v-list-item-subtitle>
{{ uri }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-expand-transition>
<v-card-actions>
<v-card-actions>
<v-spacer
/>
<v-spacer
/>
<v-btn
<v-btn
@@ -36,7 +81,8 @@
@@ -36,7 +81,8 @@
<v-btn
<v-btn
color=
"blue darken-1"
color=
"blue darken-1"
text
text
@
click=
"dialog = false"
>
:disabled=
"!model || !uri"
@
click=
"save"
>
Save
Save
</v-btn>
</v-btn>
</v-card-actions>
</v-card-actions>
@@ -47,54 +93,97 @@
@@ -47,54 +93,97 @@
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
column
:
{
type
:
Object
,
default
:
()
=>
({})
}
column
:
{
type
:
Object
,
default
:
()
=>
({})
},
tableId
:
{
type
:
Number
,
default
:
()
=>
-
1
}
},
},
data
()
{
data
()
{
return
{
return
{
dialog
:
false
,
dialog
:
false
,
isLoading
:
false
,
isLoading
:
false
,
saved
:
false
,
model
:
null
,
model
:
null
,
uri
:
null
,
search
:
null
,
search
:
null
,
entries
:
[]
entries
:
[]
}
}
},
},
computed
:
{
computed
:
{
name
()
{
return
this
.
saved
&&
this
.
model
&&
this
.
model
.
name
},
items
()
{
items
()
{
return
this
.
entries
.
map
((
entry
)
=>
{
return
this
.
entries
&&
this
.
entries
.
map
((
entry
)
=>
{
const
Description
=
entry
.
Description
.
length
>
this
.
descriptionLimit
return
{
?
entry
.
Description
.
slice
(
0
,
this
.
descriptionLimit
)
+
'
...
'
// text: `${entry.name} [${entry.symbol}], ${entry.comment}`,
:
entry
.
Description
text
:
entry
.
name
,
value
:
entry
return
Object
.
assign
({},
entry
,
{
Description
})
}
})
})
}
}
},
},
watch
:
{
watch
:
{
search
(
val
)
{
async
model
(
val
)
{
// Items have already been loaded
this
.
uri
=
null
if
(
this
.
items
.
length
>
0
)
{
return
}
this
.
saved
=
false
if
(
!
val
)
{
return
}
// Items have already been requested
try
{
const
res
=
await
this
.
$axios
.
get
(
`/api/units/uri/
${
val
.
name
}
`
)
this
.
uri
=
res
.
data
.
URI
}
catch
(
err
)
{
this
.
$toast
.
error
(
`Could not load URI of unit "
${
val
.
name
}
"`
)
console
.
log
(
err
)
}
},
async
search
(
val
)
{
if
(
this
.
isLoading
)
{
return
}
if
(
this
.
isLoading
)
{
return
}
if
(
!
val
||
!
val
.
length
)
{
return
}
this
.
isLoading
=
true
this
.
isLoading
=
true
try
{
// Lazily load input items
const
res
=
await
this
.
$axios
.
post
(
'
/api/units/suggest
'
,
{
this
.
$axios
.
get
(
'
/api/units/suggest
'
)
offset
:
0
,
.
then
((
res
)
=>
{
ustring
:
this
.
search
debugger
this
.
entries
=
res
})
})
.
catch
((
err
)
=>
{
this
.
entries
=
res
.
data
console
.
log
(
err
)
}
catch
(
err
)
{
})
this
.
$toast
.
error
(
'
Could not load unit suggestions.
'
)
.
finally
(()
=>
(
this
.
isLoading
=
false
))
console
.
log
(
err
)
}
this
.
isLoading
=
false
}
}
},
},
mounted
()
{
mounted
()
{
},
},
methods
:
{
methods
:
{
async
save
()
{
try
{
await
this
.
$axios
.
post
(
'
/api/units/saveconcept
'
,
{
name
:
this
.
model
.
name
,
uri
:
this
.
uri
})
}
catch
(
error
)
{
const
{
status
}
=
error
.
response
if
(
status
!==
201
&&
status
!==
400
)
{
this
.
$toast
.
error
(
'
Could not save concept.
'
)
console
.
log
(
error
)
}
}
try
{
await
this
.
$axios
.
post
(
'
/api/units/savecolumnsconcept
'
,
{
cdbid
:
Number
(
this
.
$route
.
params
.
database_id
),
cid
:
this
.
column
.
id
,
tid
:
this
.
tableId
,
uri
:
this
.
uri
})
this
.
dialog
=
false
this
.
saved
=
true
this
.
$nextTick
(()
=>
{
this
.
$emit
(
'
save
'
,
this
.
tableId
)
})
}
catch
(
err
)
{
this
.
$toast
.
error
(
'
Could not save column unit.
'
)
console
.
log
(
err
)
}
}
}
}
}
}
</
script
>
</
script
>
Loading