Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
dashboard
Commits
234b43c8
"src/plugins/trackservice.py" did not exist on "f5b7e0e6f6f9a45534929d763456f3383d7f3ae0"
Commit
234b43c8
authored
6 years ago
by
jackie / Andrea Ida Malkah Klaura
Browse files
Options
Downloads
Patches
Plain Diff
implement simple file upload
parent
b9f610ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/FileManager.vue
+72
-1
72 additions, 1 deletion
src/components/FileManager.vue
with
72 additions
and
1 deletion
src/components/FileManager.vue
+
72
−
1
View file @
234b43c8
...
@@ -158,7 +158,78 @@ export default {
...
@@ -158,7 +158,78 @@ export default {
alert
(
'
By the mighty witchcraftry of the mother of time!
\n\n
This feature is not implemented yet.
'
)
alert
(
'
By the mighty witchcraftry of the mother of time!
\n\n
This feature is not implemented yet.
'
)
},
},
addFile
:
function
()
{
addFile
:
function
()
{
this
.
notYetImplemented
()
var
uri
=
process
.
env
.
VUE_APP_API_TANK
+
'
shows/
'
+
this
.
shows
[
this
.
currentShow
].
slug
+
'
/files
'
if
(
this
.
addNewFileURI
)
{
//this.uploadSourceURI
this
.
notYetImplemented
()
}
else
if
(
this
.
uploadSourceFile
)
{
axios
.
post
(
uri
,
{
'
source-uri
'
:
encodeURI
(
'
upload://
'
+
this
.
uploadSourceFile
.
name
)
},
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
user
.
access_token
}
}).
then
(
response
=>
{
this
.
startUpload
(
response
.
data
.
id
)
this
.
fetchShows
(
this
.
shows
[
this
.
currentShow
].
slug
)
}).
catch
(
error
=>
{
console
.
log
(
'
Error:
'
)
console
.
log
(
error
)
alert
(
'
Error: could not add the new file upload. See console log for details.
'
)
})
}
else
{
alert
(
'
Something is wrong. You have choose to upload a file, but the corresponding file object does not exist.
'
)
}
},
startUpload
:
function
(
id
)
{
var
uri
=
process
.
env
.
VUE_APP_API_TANK
+
'
shows/
'
+
this
.
shows
[
this
.
currentShow
].
slug
+
'
/files/
'
+
id
+
'
/import
'
axios
.
get
(
uri
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
user
.
access_token
},
params
:
{
'
wait-for
'
:
'
running
'
}
}).
then
(
this
.
upload
(
id
)
).
catch
(
error
=>
{
console
.
log
(
'
Error:
'
)
console
.
log
(
error
)
alert
(
'
Error: could not start the file upload. See console log for details.
'
)
})
},
upload
:
function
(
id
)
{
/*
* NOTE: there is no npm package for flow.js and importing it manually did not
* work so far. therefore this is commented out and we are using the simple
* upload method, until there is a nice npm package for flow.js or somone
* resolves this issue otherwise
var flow = new Flow({
target: process.env.VUE_APP_API_TANK + 'shows/' + this.shows[this.currentShow].slug + '/files/' + id + '/upload',
chunkSize: 100 * 1024,
prioritizeFirstAndLastChunk: true
})
flow.on('fileSuccess', function(file, message) {
console.log(file, message)
})
flow.on('fileError', function(file, message) {
console.log(file, message)
alert('Error: could not upload your file. See console log for details.')
})
flow.addFile(this.uploadSourceFile)
flow.upload()
*/
var
uri
=
process
.
env
.
VUE_APP_API_TANK
+
'
shows/
'
+
this
.
shows
[
this
.
currentShow
].
slug
+
'
/files/
'
+
id
+
'
/upload
'
//var reader = new FileReader()
//axios.put(uri, reader.readAsArrayBuffer(this.uploadSourceFile), {
axios
.
put
(
uri
,
this
.
uploadSourceFile
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
user
.
access_token
,
'
Content-Type
'
:
'
application/octet-stream
'
}
}).
then
(
response
=>
{
console
.
log
(
'
Sucessfully uploaded file. Response data:
'
)
console
.
log
(
response
.
data
)
}).
catch
(
error
=>
{
console
.
log
(
'
Error:
'
)
console
.
log
(
error
)
alert
(
'
Error: could not start the file upload. See console log for details.
'
)
})
},
},
switchShow
:
function
(
index
)
{
switchShow
:
function
(
index
)
{
// set the current show and its ID to whatever we want to switch to now
// set the current show and its ID to whatever we want to switch to now
...
...
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