Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
6678349f
Commit
6678349f
authored
May 19, 2020
by
jackie / Andrea Ida Malkah Klaura
Browse files
move file listing and show selector to own components
parent
9296781e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
src/components/FileManager.vue
View file @
6678349f
This diff is collapsed.
Click to expand it.
src/components/ShowSelector.vue
View file @
6678349f
...
@@ -27,6 +27,7 @@ import { mapGetters } from 'vuex'
...
@@ -27,6 +27,7 @@ import { mapGetters } from 'vuex'
export
default
{
export
default
{
props
:
{
props
:
{
title
:
{
type
:
String
,
default
:
'
Unlabeled component title
'
},
title
:
{
type
:
String
,
default
:
'
Unlabeled component title
'
},
callback
:
{
type
:
Function
,
default
:
null
}
},
},
computed
:
{
computed
:
{
...
@@ -45,6 +46,7 @@ export default {
...
@@ -45,6 +46,7 @@ export default {
methods
:
{
methods
:
{
switchShow
:
function
(
index
)
{
switchShow
:
function
(
index
)
{
this
.
$store
.
commit
(
'
shows/switchShow
'
,
index
)
this
.
$store
.
commit
(
'
shows/switchShow
'
,
index
)
if
(
this
.
callback
)
{
this
.
callback
()
}
},
},
}
}
}
}
...
...
src/components/filemanager/Files.vue
0 → 100644
View file @
6678349f
This diff is collapsed.
Click to expand it.
src/store/modules/files.js
View file @
6678349f
import
axios
from
'
axios
'
import
handleApiError
from
'
../handleApiError
'
const
state
=
{
const
state
=
{
items
:
[],
files
:
[],
loaded
:
{
files
:
false
,
}
}
}
const
getters
=
{
const
getters
=
{
item
s
:
state
=>
state
.
item
s
,
file
s
:
state
=>
state
.
file
s
,
item
Count
:
state
=>
state
.
item
s
.
length
,
file
Count
:
state
=>
state
.
file
s
.
length
,
}
}
const
actions
=
{
const
mutations
=
{
addItem
({
commit
},
item
)
{
loading
(
state
,
item
)
{
state
.
loaded
[
item
]
=
false
},
commit
(
'
addItem
'
,
item
)
finishLoading
(
state
,
item
)
{
state
.
loaded
[
item
]
=
true
},
}
setFiles
(
state
,
files
)
{
state
.
files
=
files
},
addFile
(
state
,
file
)
{
state
.
files
.
push
(
file
)
},
}
}
const
mutations
=
{
const
actions
=
{
addItem
(
state
,
item
)
{
// Fetch all files for a given show from the AuRa tank API
state
.
items
.
push
(
item
)
fetchFiles
(
ctx
,
data
)
{
}
ctx
.
commit
(
'
loading
'
,
'
files
'
)
let
uri
=
process
.
env
.
VUE_APP_API_TANK
+
'
shows/
'
+
data
.
slug
+
'
/files
'
axios
.
get
(
uri
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
ctx
.
rootState
.
auth
.
user
.
access_token
}
}).
then
(
response
=>
{
// we don't have to check separately, if there are files, because tank
// always provides an empty array if there are no files (or even if there is no corresponding show)
ctx
.
commit
(
'
setFiles
'
,
response
.
data
.
results
)
ctx
.
commit
(
'
finishLoading
'
,
'
files
'
)
if
(
data
&&
typeof
(
data
.
callback
)
===
'
function
'
)
{
data
.
callback
()
}
}).
catch
(
error
=>
{
handleApiError
(
this
,
error
,
'
could not load shows
'
)
if
(
data
&&
typeof
(
data
.
callbackCancel
)
===
'
function
'
)
{
data
.
callbackCancel
()
}
})
},
}
}
export
default
{
export
default
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment