mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #40787 from nextcloud/fix/stable27-wrong-quota-files-app
This commit is contained in:
commit
c2d5a6006f
6 changed files with 23 additions and 20 deletions
|
|
@ -261,7 +261,7 @@ export default Vue.extend({
|
|||
if (typeof size !== 'number' || size < 0) {
|
||||
return this.t('files', 'Pending')
|
||||
}
|
||||
return formatFileSize(size, true)
|
||||
return formatFileSize(size, true, true).replace('iB', 'B')
|
||||
},
|
||||
sizeOpacity() {
|
||||
const size = parseInt(this.source.size, 10) || 0
|
||||
|
|
|
|||
|
|
@ -127,11 +127,11 @@ export default Vue.extend({
|
|||
totalSize() {
|
||||
// If we have the size already, let's use it
|
||||
if (this.currentFolder?.size) {
|
||||
return formatFileSize(this.currentFolder.size, true)
|
||||
return formatFileSize(this.currentFolder.size, true, true).replace('iB', 'B')
|
||||
}
|
||||
|
||||
// Otherwise let's compute it
|
||||
return formatFileSize(this.nodes.reduce((total, node) => total + node.size || 0, 0), true)
|
||||
return formatFileSize(this.nodes.reduce((total, node) => total + node.size || 0, 0), true, true).replace('iB', 'B')
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ export default {
|
|||
|
||||
computed: {
|
||||
storageStatsTitle() {
|
||||
const usedQuotaByte = formatFileSize(this.storageStats?.used)
|
||||
const quotaByte = formatFileSize(this.storageStats?.quota)
|
||||
const usedQuotaByte = formatFileSize(this.storageStats?.used, false, true).replace('iB', 'B')
|
||||
const quotaByte = formatFileSize(this.storageStats?.quota, false, true).replace('iB', 'B')
|
||||
|
||||
// If no quota set
|
||||
if (this.storageStats?.quota < 0) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
import * as InitialState from '@nextcloud/initial-state'
|
||||
import * as L10n from '@nextcloud/l10n'
|
||||
import FolderSvg from '@mdi/svg/svg/folder.svg'
|
||||
import ShareSvg from '@mdi/svg/svg/share-variant.svg'
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import FolderSvg from '@mdi/svg/svg/folder.svg?raw'
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import ShareSvg from '@mdi/svg/svg/share-variant.svg?raw'
|
||||
import { createTestingPinia } from '@pinia/testing'
|
||||
|
||||
import NavigationService from '../services/Navigation.ts'
|
||||
import NavigationService from '../services/Navigation'
|
||||
import NavigationView from './Navigation.vue'
|
||||
import router from '../router/router.js'
|
||||
import { useViewConfigStore } from '../store/viewConfig'
|
||||
import { Folder } from '@nextcloud/files'
|
||||
|
||||
describe('Navigation renders', () => {
|
||||
const Navigation = new NavigationService() as NavigationService
|
||||
|
|
@ -15,7 +18,7 @@ describe('Navigation renders', () => {
|
|||
before(() => {
|
||||
cy.stub(InitialState, 'loadState')
|
||||
.returns({
|
||||
used: 1000 * 1000 * 1000,
|
||||
used: 1024 * 1024 * 1024,
|
||||
quota: -1,
|
||||
})
|
||||
})
|
||||
|
|
@ -72,7 +75,7 @@ describe('Navigation API', () => {
|
|||
Navigation.register({
|
||||
id: 'sharing',
|
||||
name: 'Sharing',
|
||||
getContents: () => Promise.resolve(),
|
||||
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
|
||||
icon: ShareSvg,
|
||||
order: 2,
|
||||
})
|
||||
|
|
@ -99,7 +102,7 @@ describe('Navigation API', () => {
|
|||
Navigation.register({
|
||||
id: 'sharingin',
|
||||
name: 'Shared with me',
|
||||
getContents: () => Promise.resolve(),
|
||||
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
|
||||
parent: 'sharing',
|
||||
icon: ShareSvg,
|
||||
order: 1,
|
||||
|
|
@ -146,7 +149,7 @@ describe('Navigation API', () => {
|
|||
Navigation.register({
|
||||
id: 'files',
|
||||
name: 'Files',
|
||||
getContents: () => Promise.resolve(),
|
||||
getContents: () => Promise.resolve({ contents: [], folder: new Folder({ owner: 'admin', source: 'source' }) }),
|
||||
icon: FolderSvg,
|
||||
order: 1,
|
||||
})
|
||||
|
|
@ -191,7 +194,7 @@ describe('Quota rendering', () => {
|
|||
cy.stub(InitialState, 'loadState')
|
||||
.as('loadStateStats')
|
||||
.returns({
|
||||
used: 1000 * 1000 * 1000,
|
||||
used: 1024 * 1024 * 1024,
|
||||
quota: -1,
|
||||
})
|
||||
|
||||
|
|
@ -215,8 +218,8 @@ describe('Quota rendering', () => {
|
|||
cy.stub(InitialState, 'loadState')
|
||||
.as('loadStateStats')
|
||||
.returns({
|
||||
used: 1000 * 1000 * 1000,
|
||||
quota: 5 * 1000 * 1000 * 1000,
|
||||
used: 1024 * 1024 * 1024,
|
||||
quota: 5 * 1024 * 1024 * 1024,
|
||||
relative: 20, // percent
|
||||
})
|
||||
|
||||
|
|
@ -241,8 +244,8 @@ describe('Quota rendering', () => {
|
|||
cy.stub(InitialState, 'loadState')
|
||||
.as('loadStateStats')
|
||||
.returns({
|
||||
used: 5 * 1000 * 1000 * 1000,
|
||||
quota: 1000 * 1000 * 1000,
|
||||
used: 5 * 1024 * 1024 * 1024,
|
||||
quota: 1024 * 1024 * 1024,
|
||||
relative: 500, // percent
|
||||
})
|
||||
|
||||
|
|
|
|||
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue