diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 15 | ||||
-rw-r--r-- | apps/files/src/components/VirtualList.vue | 11 | ||||
-rw-r--r-- | apps/files/src/router/router.ts | 10 | ||||
-rw-r--r-- | apps/files/src/views/Sidebar.vue | 8 | ||||
-rw-r--r-- | apps/files_versions/src/files_versions_tab.js | 3 |
5 files changed, 39 insertions, 8 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 6495a84db30..7aaa43c6c01 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -22,6 +22,9 @@ <template> <tr :class="{'files-list__row--visible': visible, 'files-list__row--active': isActive}" + data-cy-files-list-row + :data-cy-files-list-row-fileid="fileid" + :data-cy-files-list-row-name="source.basename" class="list__row" @contextmenu="onRightClick"> <!-- Failed indicator --> @@ -38,7 +41,7 @@ </td> <!-- Link to file --> - <td class="files-list__row-name"> + <td class="files-list__row-name" data-cy-files-list-row-name> <!-- Icon or preview --> <span class="files-list__row-icon" @click="execDefaultAction"> <FolderIcon v-if="source.type === 'folder'" /> @@ -81,6 +84,7 @@ ref="basename" :aria-hidden="isRenaming" class="files-list__row-name-link" + data-cy-files-list-row-name-link v-bind="linkTo" @click="execDefaultAction"> <!-- File name --> @@ -93,7 +97,10 @@ </td> <!-- Actions --> - <td v-show="!isRenamingSmallScreen" :class="`files-list__row-actions-${uniqueId}`" class="files-list__row-actions"> + <td v-show="!isRenamingSmallScreen" + :class="`files-list__row-actions-${uniqueId}`" + class="files-list__row-actions" + data-cy-files-list-row-actions> <!-- Render actions --> <CustomElementRender v-for="action in enabledRenderActions" :key="action.id" @@ -115,6 +122,7 @@ :key="action.id" :class="'files-list__row-action-' + action.id" :close-after-click="true" + :data-cy-files-list-row-action="action.id" @click="onActionClick(action)"> <template #icon> <NcLoadingIcon v-if="loading === action.id" :size="18" /> @@ -129,6 +137,7 @@ <td v-if="isSizeAvailable" :style="{ opacity: sizeOpacity }" class="files-list__row-size" + data-cy-files-list-row-size @click="openDetailsIfAvailable"> <span>{{ size }}</span> </td> @@ -136,6 +145,7 @@ <!-- Mtime --> <td v-if="isMtimeAvailable" class="files-list__row-mtime" + data-cy-files-list-row-mtime @click="openDetailsIfAvailable"> <span>{{ mtime }}</span> </td> @@ -145,6 +155,7 @@ :key="column.id" :class="`files-list__row-${currentView?.id}-${column.id}`" class="files-list__row-column-custom" + :data-cy-files-list-row-column-custom="column.id" @click="openDetailsIfAvailable"> <CustomElementRender v-if="visible" :current-view="currentView" diff --git a/apps/files/src/components/VirtualList.vue b/apps/files/src/components/VirtualList.vue index b14be529c09..e028df9fea1 100644 --- a/apps/files/src/components/VirtualList.vue +++ b/apps/files/src/components/VirtualList.vue @@ -1,17 +1,17 @@ <template> - <table class="files-list"> + <table class="files-list" data-cy-files-list> <!-- Header --> <div ref="before" class="files-list__before"> <slot name="before" /> </div> <!-- Header --> - <thead ref="thead" class="files-list__thead"> + <thead ref="thead" class="files-list__thead" data-cy-files-list-thead> <slot name="header" /> </thead> <!-- Body --> - <tbody :style="tbodyStyle" class="files-list__tbody"> + <tbody :style="tbodyStyle" class="files-list__tbody" data-cy-files-list-tbody> <component :is="dataComponent" v-for="(item, i) in renderedItems" :key="i" @@ -22,7 +22,10 @@ </tbody> <!-- Footer --> - <tfoot v-show="isReady" ref="tfoot" class="files-list__tfoot"> + <tfoot v-show="isReady" + ref="tfoot" + class="files-list__tfoot" + data-cy-files-list-tfoot> <slot name="footer" /> </tfoot> </table> diff --git a/apps/files/src/router/router.ts b/apps/files/src/router/router.ts index 5e917109162..5bb8f90770b 100644 --- a/apps/files/src/router/router.ts +++ b/apps/files/src/router/router.ts @@ -21,11 +21,19 @@ */ import { generateUrl } from '@nextcloud/router' import queryString from 'query-string' -import Router from 'vue-router' +import Router, { RawLocation, Route } from 'vue-router' import Vue from 'vue' +import { ErrorHandler } from 'vue-router/types/router' Vue.use(Router) +// Prevent router from throwing errors when we're already on the page we're trying to go to +const originalPush = Router.prototype.push as (to, onComplete?, onAbort?) => Promise<Route> +Router.prototype.push = function push(to: RawLocation, onComplete?: ((route: Route) => void) | undefined, onAbort?: ErrorHandler | undefined): Promise<Route> { + if (onComplete || onAbort) return originalPush.call(this, to, onComplete, onAbort) + return originalPush.call(this, to).catch(err => err) +} + const router = new Router({ mode: 'history', diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue index a2da72ce792..f3d6fe7972e 100644 --- a/apps/files/src/views/Sidebar.vue +++ b/apps/files/src/views/Sidebar.vue @@ -374,7 +374,13 @@ export default { */ setActiveTab(id) { OCA.Files.Sidebar.setActiveTab(id) - this.tabs.forEach(tab => tab.setIsActive(id === tab.id)) + this.tabs.forEach(tab => { + try { + tab.setIsActive(id === tab.id) + } catch (error) { + logger.error('Error while setting tab active state', { error, id: tab.id, tab }) + } + }) }, /** diff --git a/apps/files_versions/src/files_versions_tab.js b/apps/files_versions/src/files_versions_tab.js index 8b816746401..a341b9009c3 100644 --- a/apps/files_versions/src/files_versions_tab.js +++ b/apps/files_versions/src/files_versions_tab.js @@ -60,6 +60,9 @@ window.addEventListener('DOMContentLoaded', function() { TabInstance.update(fileInfo) }, setIsActive(isActive) { + if (!TabInstance) { + return + } TabInstance.setIsActive(isActive) }, destroy() { |