Skip to content

Commit

Permalink
Merge pull request #924 from nextcloud/performance-test-photos
Browse files Browse the repository at this point in the history
Performance Improvements Photos
  • Loading branch information
tacruc authored Jan 10, 2023
2 parents 2a9dd96 + a93161e commit 8d6a249
Show file tree
Hide file tree
Showing 7 changed files with 518 additions and 126 deletions.
2 changes: 0 additions & 2 deletions lib/Service/GeophotoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public function getAllFromDB(string $userId, $folder=null, bool $respectNomediaA
}
$this->photosCache->set($key, $filesById, 60 * 60 * 24);
}
shuffle($filesById);
return $filesById;
}

Expand Down Expand Up @@ -241,7 +240,6 @@ public function getNonLocalizedFromDB (string $userId, $folder=null, bool $respe
}
$this->nonLocalizedPhotosCache->set($key, $filesById, 60 * 60 * 24);
}
shuffle($filesById);
return $filesById;
}

Expand Down
27 changes: 19 additions & 8 deletions src/components/AppNavigationPhotosItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
:allow-collapse="false"
:force-menu="enabled"
@click="$emit('photos-clicked')">
<NcCounterBubble v-show="enabled && photos.length"
<NcCounterBubble v-if="enabled && loading"
slot="counter">
{{ photos.length > 1000 ? Math.floor(photos.length/1000).toString() + 'k' : photos.length > 99 ? '99+' : photos.length }}
{{
(loadedPhotos > 1000 ? Math.floor(loadedPhotos/1000).toString() + 'k' : loadedPhotos > 99 ? '99+' : loadedPhotos) + '/' +
(totalPhotos > 1000 ? Math.floor(totalPhotos/1000).toString() + 'k' : totalPhotos > 99 ? '99+' : totalPhotos)
}}
</NcCounterBubble>
<NcCounterBubble v-else-if="enabled"
slot="counter">
{{ totalPhotos > 1000 ? Math.floor(totalPhotos/1000).toString() + 'k' : totalPhotos > 99 ? '99+' : totalPhotos }}
</NcCounterBubble>
<template v-if="enabled" slot="actions">
<NcActionButton v-if="!readOnly"
Expand Down Expand Up @@ -66,10 +73,18 @@ export default {
type: Boolean,
default: false,
},
photos: {
type: Array,
loadedPhotos: {
type: Number,
required: true,
},
totalPhotos: {
type: Number,
required: true,
},
readOnly: {
type: Boolean,
default: false
},
draggable: {
type: Boolean,
required: true,
Expand All @@ -87,10 +102,6 @@ export default {
},
computed: {
readOnly() {
return this.photos.every((p) => !p.isUpdateable)
|| (this.photos.length === 0 && !(optionsController.optionValues?.isCreatable && !optionsController.optionValues?.isUpdateable))
},
},
methods: {
Expand Down
10 changes: 9 additions & 1 deletion src/components/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,25 @@
ref="photosLayer"
:map="map"
:photos="photos"
:date-filter-enabled="sliderEnabled"
:date-filter-start="sliderStartTimestamp"
:date-filter-end="sliderEndTimestamp"
:draggable="photosDraggable"
@add-to-map-photo="$emit('add-to-map-photo', $event)"
@coords-reset="$emit('coords-reset', $event)"
@photo-moved="onPhotoMoved"
@open-sidebar="$emit('open-sidebar',$event)" />
@open-sidebar="$emit('open-sidebar',$event)"
@cluster-loading="$emit('photo-clusters-loading',$event)"
@cluster-loaded="$emit('photo-clusters-loaded')" />
<PhotoSuggestionsLayer
v-if="map && photosEnabled && showPhotoSuggestions"
ref="photoSuggestionsLayer"
:map="map"
:photo-suggestions="photoSuggestions"
:photo-suggestions-selected-indices="photoSuggestionsSelectedIndices"
:date-filter-enabled="sliderEnabled"
:date-filter-start="sliderStartTimestamp"
:date-filter-end="sliderEndTimestamp"
:draggable="photosDraggable"
@photo-suggestion-moved="onPhotoSuggestionMoved"
@photo-suggestion-selected="$emit('photo-suggestion-selected', $event)" />
Expand Down
Loading

0 comments on commit 8d6a249

Please sign in to comment.