Added check box for '\''show hidden files'\'' and hard coded hidden files pruning from the file api results
This commit is contained in:
parent
1529e796df
commit
a361fcda60
@ -9,6 +9,12 @@
|
|||||||
<span class="chevron"><i class="material-icons">keyboard_arrow_right</i></span>
|
<span class="chevron"><i class="material-icons">keyboard_arrow_right</i></span>
|
||||||
<router-link :to="link.url">{{ link.name }}</router-link>
|
<router-link :to="link.url">{{ link.name }}</router-link>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span style="margin-left:auto;">
|
||||||
|
<input type="checkbox">
|
||||||
|
Show hidden files
|
||||||
|
</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="error">
|
<div v-if="error">
|
||||||
@ -40,6 +46,27 @@ function clean (path) {
|
|||||||
return path.endsWith('/') ? path.slice(0, -1) : path
|
return path.endsWith('/') ? path.slice(0, -1) : path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pruneHiddenFiles removes files that start
|
||||||
|
// with a dot and update numDirs and numFiles
|
||||||
|
function pruneHiddenFiles(data) {
|
||||||
|
let numDirs = 0
|
||||||
|
let numFiles = 0
|
||||||
|
data.items = data.items.filter((item) => {
|
||||||
|
if (item.name[0] == ".") {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (item.isDir) {
|
||||||
|
numDirs++
|
||||||
|
} else {
|
||||||
|
numFiles++
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
data.numDirs = numDirs
|
||||||
|
data.numFiles = numFiles
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'files',
|
name: 'files',
|
||||||
components: {
|
components: {
|
||||||
@ -145,12 +172,17 @@ export default {
|
|||||||
if (url[0] !== '/') url = '/' + url
|
if (url[0] !== '/') url = '/' + url
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await api.fetch(url)
|
let res = await api.fetch(url)
|
||||||
|
|
||||||
if (clean(res.path) !== clean(`/${this.$route.params.pathMatch}`)) {
|
if (clean(res.path) !== clean(`/${this.$route.params.pathMatch}`)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let showHiddenFiles = false
|
||||||
|
if (!showHiddenFiles) {
|
||||||
|
res = pruneHiddenFiles(res)
|
||||||
|
}
|
||||||
|
|
||||||
this.$store.commit('updateRequest', res)
|
this.$store.commit('updateRequest', res)
|
||||||
document.title = res.name
|
document.title = res.name
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user