Hide hidden folders (fix #45)

pull/62/head
Varun Patil 2022-09-16 15:42:29 -07:00
parent 8ae5c0fc3e
commit ec397f3ae6
8 changed files with 114 additions and 82557 deletions

File diff suppressed because one or more lines are too long

View File

@ -64,17 +64,7 @@ See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License. and limitations under the License.
***************************************************************************** */ ***************************************************************************** */
/*! For license information please see NcActionButton.js.LICENSE.txt */ /*! For license information please see ncvuecomponents.js.LICENSE.txt */
/*! For license information please see NcActions.js.LICENSE.txt */
/*! For license information please see NcAppContent.js.LICENSE.txt */
/*! For license information please see NcAppNavigation.js.LICENSE.txt */
/*! For license information please see NcAppNavigationItem.js.LICENSE.txt */
/*! For license information please see NcAppNavigationSettings.js.LICENSE.txt */
/*! Hammer.JS - v2.0.7 - 2016-04-22 /*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/ * http://hammerjs.github.io/
@ -140,6 +130,52 @@ and limitations under the License.
* *
*/ */
/**
* @copyright Copyright (c) 2019 Georg Ehrke
*
* @author Georg Ehrke <georg-nextcloud@ehrke.email>
*
* @author Richard Steinmetz <richard@steinmetz.cloud>
*
* @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/>.
*
*/
/**
* @copyright Copyright (c) 2019 Georg Ehrke
*
* @author Georg Ehrke <georg-nextcloud@ehrke.email>
*
* @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/>.
*
*/
/** /**
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com> * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
* *
@ -162,6 +198,28 @@ and limitations under the License.
* *
*/ */
/**
* @copyright Copyright (c) 2021 Christoph Wurst
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @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/>.
*
*/
/** /**
* @license nested-property https://github.com/cosmosio/nested-property * @license nested-property https://github.com/cosmosio/nested-property
* *

File diff suppressed because one or more lines are too long

View File

@ -12,6 +12,8 @@ use OCP\IConfig;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\Util; use OCP\Util;
use OCA\Memories\AppInfo\Application;
class PageController extends Controller { class PageController extends Controller {
protected $userId; protected $userId;
protected $appName; protected $appName;
@ -53,9 +55,11 @@ class PageController extends Controller {
$this->eventDispatcher->dispatchTyped(new LoadSidebar()); $this->eventDispatcher->dispatchTyped(new LoadSidebar());
$this->eventDispatcher->dispatchTyped(new LoadViewer()); $this->eventDispatcher->dispatchTyped(new LoadViewer());
$uid = $user->getUid();
$timelinePath = \OCA\Memories\Util::getPhotosPath($this->config, $user->getUid()); $timelinePath = \OCA\Memories\Util::getPhotosPath($this->config, $uid);
$this->initialState->provideInitialState('timelinePath', $timelinePath); $this->initialState->provideInitialState('timelinePath', $timelinePath);
$this->initialState->provideInitialState('showHidden', $this->config->getUserValue(
$uid, Application::APPNAME, 'showHidden', false));
$response = new TemplateResponse($this->appName, 'main'); $response = new TemplateResponse($this->appName, 'main');
return $response; return $response;

View File

@ -51,11 +51,10 @@
<script lang="ts"> <script lang="ts">
import { Component, Mixins } from 'vue-property-decorator'; import { Component, Mixins } from 'vue-property-decorator';
import NcContent from '@nextcloud/vue/dist/Components/NcContent'; import {
import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent'; NcContent, NcAppContent, NcAppNavigation,
import NcAppNavigation from '@nextcloud/vue/dist/Components/NcAppNavigation'; NcAppNavigationItem, NcAppNavigationSettings,
import NcAppNavigationItem from '@nextcloud/vue/dist/Components/NcAppNavigationItem'; } from '@nextcloud/vue';
import NcAppNavigationSettings from '@nextcloud/vue/dist/Components/NcAppNavigationSettings';
import Timeline from './components/Timeline.vue' import Timeline from './components/Timeline.vue'
import Settings from './components/Settings.vue' import Settings from './components/Settings.vue'

View File

@ -24,9 +24,14 @@
<div> <div>
<label for="timeline-path">{{ t('memories', 'Timeline Path') }}</label> <label for="timeline-path">{{ t('memories', 'Timeline Path') }}</label>
<input id="timeline-path" <input id="timeline-path"
v-model="timelinePath" v-model="config_timelinePath"
type="text"> type="text">
<NcCheckboxRadioSwitch :checked.sync="config_showHidden"
type="switch">
{{ t('memories', 'Show hidden folders') }}
</NcCheckboxRadioSwitch>
<button @click="updateAll()"> <button @click="updateAll()">
{{ t('memories', 'Update') }} {{ t('memories', 'Update') }}
</button> </button>
@ -46,9 +51,16 @@ import GlobalMixin from '../mixins/GlobalMixin';
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
import UserConfig from '../mixins/UserConfig' import UserConfig from '../mixins/UserConfig'
@Component import { NcCheckboxRadioSwitch } from '@nextcloud/vue'
@Component({
components: {
NcCheckboxRadioSwitch,
},
})
export default class Settings extends Mixins(UserConfig, GlobalMixin) { export default class Settings extends Mixins(UserConfig, GlobalMixin) {
async updateAll() { async updateAll() {
await this.updateSetting('showHidden');
const res = await this.updateSetting('timelinePath'); const res = await this.updateSetting('timelinePath');
if (res.status === 200) { if (res.status === 200) {
window.location.reload(); window.location.reload();

View File

@ -118,15 +118,14 @@ import { IDay, IFolder, IHeadRow, IPhoto, IRow, IRowType, ITick } from "../types
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
import GlobalMixin from '../mixins/GlobalMixin'; import GlobalMixin from '../mixins/GlobalMixin';
import NcActions from '@nextcloud/vue/dist/Components/NcActions'; import { NcActions, NcActionButton, NcButton } from '@nextcloud/vue';
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton';
import NcButton from '@nextcloud/vue/dist/Components/NcButton';
import * as dav from "../services/DavRequests"; import * as dav from "../services/DavRequests";
import * as utils from "../services/Utils"; import * as utils from "../services/Utils";
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import Folder from "./Folder.vue"; import Folder from "./Folder.vue";
import Photo from "./Photo.vue"; import Photo from "./Photo.vue";
import UserConfig from "../mixins/UserConfig";
import Star from 'vue-material-design-icons/Star.vue'; import Star from 'vue-material-design-icons/Star.vue';
import Download from 'vue-material-design-icons/Download.vue'; import Download from 'vue-material-design-icons/Download.vue';
@ -165,7 +164,7 @@ for (const [key, value] of Object.entries(API_ROUTES)) {
CheckCircle, CheckCircle,
} }
}) })
export default class Timeline extends Mixins(GlobalMixin) { export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
/** Loading days response */ /** Loading days response */
private loading = 0; private loading = 0;
/** Main list of rows */ /** Main list of rows */
@ -779,9 +778,19 @@ export default class Timeline extends Mixins(GlobalMixin) {
delete photo.isfolder; delete photo.isfolder;
} }
this.list[rowIdx].photos.push(photo); // Move to next index of photo
dataIdx++; dataIdx++;
// Hidden folders
if (!this.config_showHidden &&
(photo.flag & this.c.FLAG_IS_FOLDER) &&
(<IFolder>photo).name.startsWith('.'))
{
continue;
}
this.list[rowIdx].photos.push(photo);
// Add row to day // Add row to day
head.day.rows.add(row); head.day.rows.add(row);
} }

View File

@ -30,7 +30,8 @@ const eventName = 'memories:user-config-changed'
@Component @Component
export default class UserConfig extends Vue { export default class UserConfig extends Vue {
timelinePath = loadState('memories', 'timelinePath') || ''; config_timelinePath = loadState('memories', 'timelinePath') || '';
config_showHidden = loadState('memories', 'showHidden') === "true";
created() { created() {
subscribe(eventName, this.updateLocalSetting) subscribe(eventName, this.updateLocalSetting)
@ -45,7 +46,7 @@ export default class UserConfig extends Vue {
} }
async updateSetting(setting: string) { async updateSetting(setting: string) {
const value = this[setting] const value = this['config_' + setting]
// Long time save setting // Long time save setting
const res = await axios.put(generateUrl('apps/memories/api/config/' + setting), { const res = await axios.put(generateUrl('apps/memories/api/config/' + setting), {
value: value.toString(), value: value.toString(),