-
{{ file.filename }}
-
{{ file.filepath }}
+
{{ !showFullFilePath ? file.filename : file.filepath }}
{{ file.fileowner }}
{{ formatBytes(Number(file.filesize)) }}
@@ -249,7 +248,7 @@ export default {
emit('updateGroupFilesPagination', this.file)
} else if ('locked' in res.data && res.data.locked) {
showWarning(this.t('mediadc', 'Wait until file has been loaded before deleting it'))
- } else if ('not_permited' in res.data && res.data.not_permited) {
+ } else if ('not_permitted' in res.data && res.data.not_permited) {
showError(this.t('mediadc', 'Not enough permissions to delete the file'))
} else if ('not_found' in res.data && res.data.not_found) {
showError(this.t('mediadc', 'File not found. Probably it\'s has been already deleted'))
@@ -376,6 +375,8 @@ body[data-theme-dark] .placeholder {
}
.filepath {
+ width: 100%;
+ line-break: anywhere;
border-bottom: 1px solid var(--color-border-dark);
padding-bottom: 5px;
margin-bottom: 5px;
diff --git a/src/components/details/DetailsList.vue b/src/components/details/DetailsList.vue
index a522e7af..05dac2af 100755
--- a/src/components/details/DetailsList.vue
+++ b/src/components/details/DetailsList.vue
@@ -84,29 +84,56 @@
{{ n('mediadc', 'Batch actions for %n group', 'Batch actions for %n groups', checkedDetailGroups.length) }}
-
+
+
+
+
{{ checkedDetailGroups.length === details.length ? t('mediadc', 'Deselect all') : t('mediadc', 'Select all') }}
-
+
+
+
+
{{ checkedDetailGroupsIntersect.length === paginatedDetails[page].length || checkedDetailGroupsIntersect.length === paginatedSortedDetails[page].length ? t('mediadc', 'Deselect all on page') : t('mediadc', 'Select all on page') }}
-
+
+
+
+
{{ checkedDetailGroups.length === detailsFiltered.length ? t('mediadc', 'Deselect all') : t('mediadc', 'Select all') }}
-
+
+
+
+
{{ checkedDetailGroupsIntersect.length === paginatedDetailsFiltered[page].length ? t('mediadc', 'Deselect all on page') : t('mediadc', 'Select all on page') }}
-
+
+
+
+
{{ t('mediadc', 'Uncheck selected') }}
{{ n('mediadc', 'Remove group', 'Remove groups', checkedDetailGroups.length) }}
+
+
+
+
+
+
+
+ {{ t('mediadc', 'Delete files') }}
+
@@ -168,6 +195,10 @@ import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadi
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
+import MinusBoxOutline from 'vue-material-design-icons/MinusBoxOutline.vue'
+import CheckAll from 'vue-material-design-icons/CheckAll.vue'
+import CheckUnderline from 'vue-material-design-icons/CheckUnderline.vue'
+import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import { mapGetters } from 'vuex'
@@ -185,6 +216,10 @@ export default {
NcActions,
NcActionButton,
Pagination,
+ MinusBoxOutline,
+ CheckAll,
+ CheckUnderline,
+ NcLoadingIcon,
},
mixins: [Formats],
data() {
@@ -194,6 +229,7 @@ export default {
checkedDetailGroups: [],
batchActionsOpened: false,
sortGroups: true,
+ batchDeleting: false,
}
},
computed: {
@@ -346,6 +382,36 @@ export default {
}
}
},
+ deleteCheckedGroupsFiles() {
+ this.batchDeleting = true
+ axios.post(generateUrl(`/apps/mediadc/api/v1/tasks/${this.task.id}/details/delete`), { groupIds: this.checkedDetailGroups.map(d => d.group_id) }).then(res => {
+ if (res.data.success) {
+ emit('openNextDetailGroup', this.checkedDetailGroups[this.checkedDetailGroups.length - 1])
+ const updatedDetails = [...this.details]
+ for (const removedGroupId of res.data.removedGroupIds) {
+ const checkedIndex = this.checkedDetailGroups.findIndex(d => Number(d.group_id) === removedGroupId)
+ if (checkedIndex !== -1) {
+ this.checkedDetailGroups.splice(checkedIndex, 1)
+ }
+ const removedDetailIndex = updatedDetails.findIndex(d => Number(d.group_id) === removedGroupId)
+ updatedDetails.splice(removedDetailIndex, 1)
+ }
+ emit('updateTaskInfo')
+ this.$store.commit('setDetails', updatedDetails)
+ this.$store.commit('setTask', res.data.task)
+ showSuccess(this.t('mediadc', 'Selected groups files successfully deleted'))
+ } else if (res.data.removedGroupIds.length !== 0) {
+ showWarning(this.t('mediadc', 'Not all selected groups files deleted'))
+ } else {
+ showError(this.t('mediadc', 'Failed to delete selected groups files'))
+ }
+ this.batchDeleting = false
+ }).catch(err => {
+ showError(this.t('mediadc', 'A server error occurred'))
+ console.debug(err)
+ this.batchDeleting = false
+ })
+ },
selectAllGroups() {
const _details = (!this.filtered) ? this.details : this.detailsFiltered
if (this.checkedDetailGroups.length === _details.length) {
diff --git a/src/components/settings/AdminSettings.vue b/src/components/settings/AdminSettings.vue
index df87de3f..fd88dddd 100755
--- a/src/components/settings/AdminSettings.vue
+++ b/src/components/settings/AdminSettings.vue
@@ -160,6 +160,7 @@
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError, showSuccess, showWarning } from '@nextcloud/dialogs'
+import { loadState } from '@nextcloud/initial-state'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
@@ -201,21 +202,29 @@ export default {
}
},
beforeMount() {
- this.getSettings()
+ this.settings = loadState('mediadc', 'settings', null)
+ if (this.settings !== null) {
+ this.mapSettings(this.settings)
+ } else {
+ this.getSettings()
+ }
},
methods: {
getSettings() {
axios.get(generateUrl('/apps/mediadc/api/v1/settings')).then(res => {
this.settings = res.data
- this.settings.forEach(setting => {
- this.mappedSettings[setting.name] = setting
- })
- this.algorithms = ['average', 'dhash', 'phash', 'whash']
- this.hashing_algorithm = JSON.parse(this.mappedSettings.hashing_algorithm.value)
- this.hash_size = this.mappedSettings.hash_size.value
- this.customExcludeList = JSON.parse(this.mappedSettings.exclude_list.value).mask
- this.python_binary = JSON.parse(this.mappedSettings.python_binary.value)
+ this.mapSettings(this.settings)
+ })
+ },
+ mapSettings(settings) {
+ settings.forEach(setting => {
+ this.mappedSettings[setting.name] = setting
})
+ this.algorithms = ['average', 'dhash', 'phash', 'whash']
+ this.hashing_algorithm = JSON.parse(this.mappedSettings.hashing_algorithm.value)
+ this.hash_size = this.mappedSettings.hash_size.value
+ this.customExcludeList = JSON.parse(this.mappedSettings.exclude_list.value).mask
+ this.python_binary = JSON.parse(this.mappedSettings.python_binary.value)
},
saveChanges() {
axios.put(generateUrl('/apps/mediadc/api/v1/settings'), { settings: this.settings })
diff --git a/src/views/Collector.vue b/src/views/Collector.vue
index 3b43bbc2..c1e3ff3e 100755
--- a/src/views/Collector.vue
+++ b/src/views/Collector.vue
@@ -42,6 +42,7 @@
import TasksNew from '../components/tasks/TasksNew.vue'
import TasksList from '../components/tasks/TasksList.vue'
import { loadState } from '@nextcloud/initial-state'
+import { mapActions } from 'vuex'
export default {
name: 'Collector',
@@ -65,27 +66,34 @@ export default {
}
},
beforeMount() {
- const tasks = loadState('mediadc', 'tasks', false)
- const settings = loadState('mediadc', 'settings', false)
- if (tasks) {
- this.$store.commit('setTasks', tasks)
+ if (this.getTasks().length > 0) {
this.$emit('update:loading', false)
- if (settings) {
- this.$store.commit('setSettings', settings)
+ } else {
+ const tasks = loadState('mediadc', 'tasks', false)
+ const settings = loadState('mediadc', 'settings', false)
+ if (tasks) {
+ this.$store.commit('setTasks', tasks)
this.$emit('update:loading', false)
- } else {
- this.$store.dispatch('getSettings').then(() => {
+ if (settings) {
+ this.$store.commit('setSettings', settings)
this.$emit('update:loading', false)
+ } else {
+ this.$store.dispatch('getSettings').then(() => {
+ this.$emit('update:loading', false)
+ })
+ }
+ } else {
+ this.$store.dispatch('getTasks', true).then(() => {
+ this.$store.dispatch('getSettings').then(() => {
+ this.$emit('update:loading', false)
+ })
})
}
- } else {
- this.$store.dispatch('getTasks', true).then(() => {
- this.$store.dispatch('getSettings').then(() => {
- this.$emit('update:loading', false)
- })
- })
}
},
+ methods: {
+ ...mapActions(['getTasks', 'getSettings']),
+ },
}
diff --git a/src/views/CollectorDetails.vue b/src/views/CollectorDetails.vue
index 0a9262ee..b7bcc68b 100755
--- a/src/views/CollectorDetails.vue
+++ b/src/views/CollectorDetails.vue
@@ -108,7 +108,7 @@
icon="icon-delete"
:close-after-click="true"
@click="deleteTask(task)">
- {{ t('mediadc', 'Delete') }}
+ {{ t('mediadc', 'Delete task') }}