Skip to content

Commit

Permalink
Merge pull request #29 from eldertek/nightly
Browse files Browse the repository at this point in the history
Nightly v1.1.2
  • Loading branch information
eldertek authored Nov 11, 2023
2 parents 4d36782 + 367a290 commit 7868dbc
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.1.2 - 2023-11-11
### Added
- Auto-fetch duplicates again when reaching the end of the list
### Removed
- Nextcloud 26 is no longer supported (DuplicateFinder will always be updated for the 2 last versions)

## 1.1.1 - 2023-11-10
### Fixed
- Fix [#24](https://github.com/eldertek/duplicatefinder/issues/24)
Expand Down
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<summary lang="fr">Économisez de l’espace en trouvant vos fichiers en doublon</summary>
<description>Are you tired of sifting through piles of files and folders, only to discover multiple copies of the same content cluttering your storage space?</description>
<description lang="fr">Vous en avez assez de passer au crible des piles de fichiers et de dossiers pour découvrir que plusieurs copies du même contenu encombrent votre espace de stockage ?</description>
<version>1.1.1</version>
<version>1.1.2</version>
<licence>agpl</licence>
<author mail="andrelauret@eclipse-technology.eu" >André Théo LAURET</author>
<namespace>DuplicateFinder</namespace>
<category>tools</category>
<bugs>https://github.com/eldertek/duplicatefinder/issues</bugs>
<screenshot>https://raw.githubusercontent.com/eldertek/duplicatefinder/master/img/preview.png</screenshot>
<dependencies>
<nextcloud min-version="26" max-version="28"/>
<nextcloud min-version="27" max-version="28"/>
</dependencies>
<background-jobs>
<job>OCA\DuplicateFinder\BackgroundJob\CleanUpDB</job>
Expand Down
4 changes: 2 additions & 2 deletions js/duplicatefinder-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/duplicatefinder-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "duplicatefinder",
"description": "Save some space by finding your duplicate files",
"version": "1.1.1",
"version": "1.1.2",
"author": "André Théo LAURET <andrelauret@eclipse-technology.eu>",
"contributors": [],
"bugs": {
Expand Down
75 changes: 73 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<NcContent app-name="duplicatefinder">
<NcAppNavigation v-if="acknowledgedDuplicates.length > 0 || unacknowledgedDuplicates.length > 0">
<NcAppNavigation v-if="(acknowledgedDuplicates.length > 0 || unacknowledgedDuplicates.length > 0) && !loading">
<template #list>
<NcAppNavigationItem name="Uncknowledged" :allowCollapse="true" :open="true">
<template #icon>
Expand Down Expand Up @@ -64,7 +64,13 @@
</div>
<div v-else id="emptycontent">
<div class="icon-file" />
<h2>{{ t('duplicatefinder', 'No duplicates found or no duplicate selected.') }}</h2>
<div v-if="loading">
<h2>{{ t('duplicatefinder', 'Fetching duplicates') }} {{ loadingDots }}</h2>
</div>
<div v-else>
<div class="icon-file" />
<h2>{{ t('duplicatefinder', 'No duplicates found or no duplicate selected.') }}</h2>
</div>
</div>
</NcAppContent>
</NcContent>
Expand Down Expand Up @@ -99,6 +105,8 @@ export default {
currentDuplicateId: null,
updating: false,
loading: true,
loadingDots: '',
loadingInterval: null,
groupedResult: {
groupedItems: [],
Expand Down Expand Up @@ -137,7 +145,20 @@ export default {
return OC.Util.humanFileSize(this.sizeOfCurrentDuplicate);
}
},
watch: {
'acknowledgedDuplicates.length'(newLength) {
if (newLength <= 3) {
this.fetchDuplicates('acknowledged');
}
},
'unacknowledgedDuplicates.length'(newLength) {
if (newLength <= 3) {
this.fetchDuplicates('unacknowledged');
}
},
},
async mounted() {
this.startLoadingAnimation();
try {
const responseAcknowledged = await axios.get(generateUrl('/apps/duplicatefinder/api/duplicates/acknowledged'));
this.acknowledgedDuplicates = responseAcknowledged.data.data.entities;
Expand All @@ -154,8 +175,58 @@ export default {
showError(t('duplicatefinder', 'Could not fetch duplicates'));
}
this.loading = false;
this.stopLoadingAnimation();
},
methods: {
startLoadingAnimation() {
this.loadingDots = '';
this.loadingInterval = setInterval(() => {
this.loadingDots += '.';
if (this.loadingDots.length > 3) {
this.loadingDots = '';
}
}, 500); // Change dot every 500ms
},
stopLoadingAnimation() {
clearInterval(this.loadingInterval);
this.loadingDots = ''; // Reset loading dots
},
async fetchDuplicates(type) {
let url;
if (type === 'acknowledged') {
url = generateUrl('/apps/duplicatefinder/api/duplicates/acknowledged');
} else if (type === 'unacknowledged') {
url = generateUrl('/apps/duplicatefinder/api/duplicates/unacknowledged');
} else {
console.error('Invalid type');
showError(t('duplicatefinder', 'Could not fetch duplicates'));
return;
}
try {
const response = await axios.get(url);
const newDuplicates = response.data.data.entities;
if (type === 'acknowledged') {
// Keep track of the last three items' IDs
const lastThreeIds = this.acknowledgedDuplicates.slice(-3).map(dup => dup.id);
// Filter out any new items that are already in the last three
const filteredNewDuplicates = newDuplicates.filter(dup => !lastThreeIds.includes(dup.id));
// Combine the last three with the filtered new items
this.acknowledgedDuplicates = [...this.acknowledgedDuplicates.slice(-3), ...filteredNewDuplicates];
} else {
// Keep track of the last three items' IDs
const lastThreeIds = this.unacknowledgedDuplicates.slice(-3).map(dup => dup.id);
// Filter out any new items that are already in the last three
const filteredNewDuplicates = newDuplicates.filter(dup => !lastThreeIds.includes(dup.id));
// Combine the last three with the filtered new items
this.unacknowledgedDuplicates = [...this.unacknowledgedDuplicates.slice(-3), ...filteredNewDuplicates];
}
} catch (e) {
console.error(e);
showError(t('duplicatefinder', `Could not fetch ${type} duplicates`));
}
},
async acknowledgeDuplicate() {
try {
const hash = this.currentDuplicate.hash;
Expand Down

0 comments on commit 7868dbc

Please sign in to comment.