Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/components/FilesListFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')
},
},

Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/components/NavigationQuota.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
27 changes: 15 additions & 12 deletions apps/files/src/views/Navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
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

before(() => {
cy.stub(InitialState, 'loadState')
.returns({
used: 1000 * 1000 * 1000,
used: 1024 * 1024 * 1024,
quota: -1,
})
})
Expand Down Expand Up @@ -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,
})
Expand All @@ -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,
Expand Down Expand Up @@ -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,
})
Expand Down Expand Up @@ -191,7 +194,7 @@ describe('Quota rendering', () => {
cy.stub(InitialState, 'loadState')
.as('loadStateStats')
.returns({
used: 1000 * 1000 * 1000,
used: 1024 * 1024 * 1024,
quota: -1,
})

Expand All @@ -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
})

Expand All @@ -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
})

Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.