Skip to content

Commit

Permalink
Merge pull request #26841 from nextcloud/bugfix/files-search-filter
Browse files Browse the repository at this point in the history
Implement local filtering in file list
  • Loading branch information
PVince81 authored Oct 26, 2021
2 parents b691f30 + 9c937a6 commit f9629c0
Show file tree
Hide file tree
Showing 19 changed files with 478 additions and 424 deletions.
75 changes: 0 additions & 75 deletions apps/files/js/dist/files-app-settings.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/files/js/dist/files-app-settings.js.map

This file was deleted.

404 changes: 404 additions & 0 deletions apps/files/js/dist/main.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/files/js/dist/main.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions apps/files/js/dist/personal-settings.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files/js/dist/personal-settings.js.map

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions apps/files/js/dist/sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files/js/dist/sidebar.js.map

Large diffs are not rendered by default.

315 changes: 0 additions & 315 deletions apps/files/js/dist/templates.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/files/js/dist/templates.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal
// Load the files we need
\OCP\Util::addStyle('files', 'merged');
\OCP\Util::addScript('files', 'merged-index');
\OCP\Util::addScript('files', 'dist/templates');
\OCP\Util::addScript('files', 'dist/main');

// mostly for the home storage's free space
// FIXME: Make non static
Expand Down
42 changes: 42 additions & 0 deletions apps/files/src/legacy/filelistSearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* @copyright Copyright (c) 2021 Julius Härtl <[email protected]>
*
* @author Julius Härtl <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import { subscribe } from '@nextcloud/event-bus'

(function() {

const FilesPlugin = {
attach(fileList) {
subscribe('nextcloud:unified-search.search', ({ query }) => {
fileList.setFilter(query)
})
subscribe('nextcloud:unified-search.reset', () => {
this.query = null
fileList.setFilter('')
})

},
}

window.OC.Plugins.register('OCA.Files.FileList', FilesPlugin)

})()
3 changes: 3 additions & 0 deletions apps/files/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './files-app-settings'
import './templates'
import './legacy/filelistSearch'
3 changes: 0 additions & 3 deletions apps/files/templates/appnavigation.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<?php
script(\OCA\Files\AppInfo\Application::APP_ID, 'dist/files-app-settings');
?>
<div id="app-navigation">
<ul class="with-icon">

Expand Down
2 changes: 1 addition & 1 deletion apps/files/templates/recentlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<input type="hidden" name="dir" value="" id="dir">

<div class="nofilterresults hidden">
<div class="nofilterresults emptycontent hidden">
<div class="icon-search"></div>
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
<p></p>
Expand Down
2 changes: 1 addition & 1 deletion apps/files/templates/simplelist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<input type="hidden" name="dir" value="" id="dir">

<div class="nofilterresults hidden">
<div class="nofilterresults emptycontent hidden">
<div class="icon-search"></div>
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
<p></p>
Expand Down
3 changes: 1 addition & 2 deletions apps/files/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ const path = require('path')

module.exports = {
entry: {
main: path.join(__dirname, 'src', 'main.js'),
sidebar: path.join(__dirname, 'src', 'sidebar.js'),
templates: path.join(__dirname, 'src', 'templates.js'),
'files-app-settings': path.join(__dirname, 'src', 'files-app-settings.js'),
'personal-settings': path.join(__dirname, 'src', 'main-personal-settings.js'),
},
output: {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/templates/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<input type="hidden" name="dir" value="" id="dir">

<div class="nofilterresults hidden">
<div class="nofilterresults emptycontent hidden">
<div class="icon-search"></div>
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/templates/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<input type="hidden" name="dir" value="" id="dir">

<div class="nofilterresults hidden">
<div class="nofilterresults emptycontent hidden">
<div class="icon-search"></div>
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
<p></p>
Expand Down

0 comments on commit f9629c0

Please sign in to comment.