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
c8e86148
Commit
c8e86148
authored
Apr 26, 2021
by
Kirill Stytsenko
Browse files
Options
Downloads
Patches
Plain Diff
Upload CSV data
parent
2e56f30d
No related branches found
No related tags found
No related merge requests found
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 @
c8e86148
...
@@ -88,7 +88,7 @@ export default {
...
@@ -88,7 +88,7 @@ export default {
const
tableId
=
this
.
tables
[
this
.
panelIndex
].
id
const
tableId
=
this
.
tables
[
this
.
panelIndex
].
id
try
{
try
{
const
res
=
await
this
.
$axios
.
get
(
`/api/tables/api/database/
${
this
.
$route
.
params
.
db_id
}
/table/
${
tableId
}
`
)
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
)
{
}
catch
(
err
)
{
this
.
$toast
.
error
(
'
Could not get table details.
'
)
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 @
c8e86148
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<v-row
dense
>
<v-row
dense
>
<v-col
cols=
"10"
>
<v-col
cols=
"10"
>
<v-file-input
<v-file-input
v-model=
"file"
accept=
"text/csv"
accept=
"text/csv"
show-size
show-size
label=
"CSV File"
/>
label=
"CSV File"
/>
...
@@ -23,19 +24,32 @@ export default {
...
@@ -23,19 +24,32 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
loading
:
false
loading
:
false
,
file
:
null
}
}
},
},
mounted
()
{
mounted
()
{
},
},
methods
:
{
methods
:
{
upload
()
{
async
upload
()
{
this
.
loading
=
true
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
.
$toast
.
success
(
'
Uploaded successfully!
'
)
this
.
loading
=
false
this
.
$router
.
push
({
path
:
'
.
'
})
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
register
or
sign in
to comment