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
4a250557
Verified
Commit
4a250557
authored
Apr 26, 2021
by
Kirill Stytsenko
Browse files
Options
Downloads
Patches
Plain Diff
Upload CSV data
parent
2aae0e5a
No related branches found
No related tags found
4 merge requests
!23
Sprint results
,
!18
Merge Conflicts
,
!15
Sprint ended, merge into master
,
!14
CSV import
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
fda-ui/components/TableList.vue
+1
-1
1 addition, 1 deletion
fda-ui/components/TableList.vue
fda-ui/pages/db/_db_id/tables/_table_id/import_csv.vue
+21
-7
21 additions, 7 deletions
fda-ui/pages/db/_db_id/tables/_table_id/import_csv.vue
with
22 additions
and
8 deletions
fda-ui/components/TableList.vue
+
1
−
1
View file @
4a250557
...
...
@@ -88,7 +88,7 @@ export default {
const
tableId
=
this
.
tables
[
this
.
panelIndex
].
id
try
{
const
res
=
await
this
.
$axios
.
get
(
`/api/tables/api/database/
${
this
.
$route
.
params
.
db_id
}
/table/
${
tableId
}
`
)
this
.
tableDetails
=
res
.
data
[
0
]
// It's a list with one element
this
.
tableDetails
=
res
.
data
}
catch
(
err
)
{
this
.
$toast
.
error
(
'
Could not get table details.
'
)
}
...
...
This diff is collapsed.
Click to expand it.
fda-ui/pages/db/_db_id/tables/_table_id/import_csv.vue
+
21
−
7
View file @
4a250557
...
...
@@ -6,6 +6,7 @@
<v-row
dense
>
<v-col
cols=
"10"
>
<v-file-input
v-model=
"file"
accept=
"text/csv"
show-size
label=
"CSV File"
/>
...
...
@@ -23,19 +24,32 @@ export default {
},
data
()
{
return
{
loading
:
false
loading
:
false
,
file
:
null
}
},
mounted
()
{
},
methods
:
{
upload
()
{
async
upload
()
{
this
.
loading
=
true
setTimeout
(()
=>
{
const
url
=
`/api/tables/api/database/
${
this
.
$route
.
params
.
db_id
}
/table/
${
this
.
$route
.
params
.
table_id
}
`
const
data
=
new
FormData
()
data
.
append
(
'
file
'
,
this
.
file
)
try
{
const
res
=
await
this
.
$axios
.
post
(
url
,
data
,
{
headers
:
{
'
Content-Type
'
:
'
multipart/form-data
'
}
})
if
(
res
.
data
.
Result
)
{
this
.
$toast
.
success
(
'
Uploaded successfully!
'
)
this
.
loading
=
false
this
.
$router
.
push
({
path
:
'
.
'
})
},
1000
)
}
else
{
this
.
$toast
.
error
(
'
Could not upload CSV data
'
)
}
}
catch
(
err
)
{
this
.
$toast
.
error
(
'
Could not upload data.
'
)
}
this
.
loading
=
false
}
}
}
...
...
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
sign in
to comment