mirror of
https://github.com/filegator/filegator.git
synced 2025-08-02 05:00:16 +02:00
Search feature
This commit is contained in:
@@ -84,10 +84,6 @@ html, body, #wrapper, #inner, .container {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animation-content {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (max-width: 1088px) {
|
@media all and (max-width: 1088px) {
|
||||||
.container {
|
.container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'изтрити',
|
'Deleted': 'изтрити',
|
||||||
'Your file is ready': 'Вашия файл е готов',
|
'Your file is ready': 'Вашия файл е готов',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': '已删除',
|
'Deleted': '已删除',
|
||||||
'Your file is ready': '您的文件已备妥',
|
'Your file is ready': '您的文件已备妥',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Verwijderd',
|
'Deleted': 'Verwijderd',
|
||||||
'Your file is ready': 'Uw bestand is verwerkt',
|
'Your file is ready': 'Uw bestand is verwerkt',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Deleted',
|
'Deleted': 'Deleted',
|
||||||
'Your file is ready': 'Your file is ready',
|
'Your file is ready': 'Your file is ready',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Supprimé',
|
'Deleted': 'Supprimé',
|
||||||
'Your file is ready': 'Votre fichier est prêt',
|
'Your file is ready': 'Votre fichier est prêt',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Gelöscht',
|
'Deleted': 'Gelöscht',
|
||||||
'Your file is ready': 'Deine Datei ist fertig',
|
'Your file is ready': 'Deine Datei ist fertig',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Dihapus',
|
'Deleted': 'Dihapus',
|
||||||
'Your file is ready': 'File Anda sudah siap',
|
'Your file is ready': 'File Anda sudah siap',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Ištrintas',
|
'Deleted': 'Ištrintas',
|
||||||
'Your file is ready': 'Jūsų failas paruoštas',
|
'Your file is ready': 'Jūsų failas paruoštas',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Excluido',
|
'Deleted': 'Excluido',
|
||||||
'Your file is ready': 'Seu arquivo está pronto',
|
'Your file is ready': 'Seu arquivo está pronto',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Obrisano',
|
'Deleted': 'Obrisano',
|
||||||
'Your file is ready': 'Vaš fajl je spreman',
|
'Your file is ready': 'Vaš fajl je spreman',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Eliminado',
|
'Deleted': 'Eliminado',
|
||||||
'Your file is ready': 'Su fichero está listo',
|
'Your file is ready': 'Su fichero está listo',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -71,6 +71,7 @@ const data = {
|
|||||||
'Deleted': 'Silindi',
|
'Deleted': 'Silindi',
|
||||||
'Your file is ready': 'Dosyanız Hazır',
|
'Your file is ready': 'Dosyanız Hazır',
|
||||||
'View': 'View',
|
'View': 'View',
|
||||||
|
'Search': 'Search',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default data
|
export default data
|
||||||
|
@@ -25,8 +25,11 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a id="sitemap" class="is-paddingless" @click="selectDir">
|
<a class="search-btn" @click="search">
|
||||||
<b-icon icon="sitemap" class="is-marginless" size="is-small" />
|
<b-icon icon="search" size="is-small" />
|
||||||
|
</a>
|
||||||
|
<a class="is-paddingless" @click="selectDir">
|
||||||
|
<b-icon icon="sitemap" size="is-small" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -156,6 +159,7 @@ import Menu from './partials/Menu'
|
|||||||
import Tree from './partials/Tree'
|
import Tree from './partials/Tree'
|
||||||
import Editor from './partials/Editor'
|
import Editor from './partials/Editor'
|
||||||
import Gallery from './partials/Gallery'
|
import Gallery from './partials/Gallery'
|
||||||
|
import Search from './partials/Search'
|
||||||
import Pagination from './partials/Pagination'
|
import Pagination from './partials/Pagination'
|
||||||
import Upload from './partials/Upload'
|
import Upload from './partials/Upload'
|
||||||
import api from '../api/api'
|
import api from '../api/api'
|
||||||
@@ -345,7 +349,16 @@ export default {
|
|||||||
window.open(this.getDownloadLink(item.path), '_blank')
|
window.open(this.getDownloadLink(item.path), '_blank')
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
// TODO: create search logic
|
this.$modal.open({
|
||||||
|
parent: this,
|
||||||
|
hasModalCard: true,
|
||||||
|
component: Search,
|
||||||
|
events: {
|
||||||
|
selected: item => {
|
||||||
|
this.goTo(item.dir)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
},
|
},
|
||||||
preview(item) {
|
preview(item) {
|
||||||
let modal = null
|
let modal = null
|
||||||
@@ -575,4 +588,7 @@ export default {
|
|||||||
.drop-info {
|
.drop-info {
|
||||||
margin: 20% auto;
|
margin: 20% auto;
|
||||||
}
|
}
|
||||||
|
.search-btn {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
89
frontend/views/partials/Search.vue
Normal file
89
frontend/views/partials/Search.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<div class="modal-card">
|
||||||
|
<header class="modal-card-head">
|
||||||
|
<p class="modal-card-title">
|
||||||
|
{{ lang('Search') }}
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
<section class="modal-card-body">
|
||||||
|
<b-input ref="input" v-model="term" @input="searchFiles" :placeholder="lang('Name')" />
|
||||||
|
<br>
|
||||||
|
<b-loading :is-full-page="false" :active.sync="searching"></b-loading>
|
||||||
|
<ul ref="results">
|
||||||
|
<li v-for="(item, index) in results" :key="index">
|
||||||
|
<a @click="select(item)">{{ item.file.path }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
<footer class="modal-card-foot">
|
||||||
|
<button class="button" type="button" @click="$parent.close()">
|
||||||
|
{{ lang('Close') }}
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import api from '../../api/api'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Search',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
active: false,
|
||||||
|
searching: false,
|
||||||
|
term: '',
|
||||||
|
results: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.active = true
|
||||||
|
this.searching = false
|
||||||
|
this.$refs.input.focus()
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.active = false
|
||||||
|
this.searching = false
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
select(item) {
|
||||||
|
this.$emit('selected', item)
|
||||||
|
this.$parent.close()
|
||||||
|
},
|
||||||
|
searchFiles: _.debounce(function(val) {
|
||||||
|
this.results = []
|
||||||
|
if (val.length > 0) {
|
||||||
|
this.searching = true
|
||||||
|
this.getDir('/')
|
||||||
|
}
|
||||||
|
}, 1000),
|
||||||
|
getDir(path) {
|
||||||
|
if (!this.active) return
|
||||||
|
this.searching = true
|
||||||
|
api.getDir({
|
||||||
|
dir: path
|
||||||
|
})
|
||||||
|
.then(ret => {
|
||||||
|
this.searching = false
|
||||||
|
_.forEach(ret.files, item => {
|
||||||
|
if (item.name.toLowerCase().indexOf(this.term.toLowerCase()) > -1) {
|
||||||
|
this.results.push({
|
||||||
|
file: item,
|
||||||
|
dir: path,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
_.forEach(_.filter(ret.files, ['type', 'dir']), subdir => {
|
||||||
|
this.getDir(subdir.path)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => this.handleError(error))
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
Reference in New Issue
Block a user