Merge pull request #3213 from alfonso-salces/MOBILE-3833
MOBILE-3833 module-summary: format file size to readable size only wh…main
commit
1ae5c6b3a7
|
@ -153,7 +153,7 @@
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
||||||
<ion-card *ngIf="(canPrefetch && displayOptions.displayPrefetch) || (sizeReadable && displayOptions.displaySize)">
|
<ion-card *ngIf="(canPrefetch && displayOptions.displayPrefetch) || (size && displayOptions.displaySize)">
|
||||||
<ion-item lines="full" class="ion-text-wrap card-header">
|
<ion-item lines="full" class="ion-text-wrap card-header">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h2>
|
<h2>
|
||||||
|
@ -162,13 +162,13 @@
|
||||||
</h2>
|
</h2>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item *ngIf="sizeReadable && displayOptions.displaySize" class="ion-text-wrap">
|
<ion-item *ngIf="size && displayOptions.displaySize" class="ion-text-wrap">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p class="item-heading ion-text-wrap">{{ 'addon.storagemanager.totalspaceusage' | translate }}</p>
|
<p class="item-heading ion-text-wrap">{{ 'addon.storagemanager.totalspaceusage' | translate }}</p>
|
||||||
<ion-badge color="light">{{ sizeReadable | coreBytesToSize }}</ion-badge>
|
<ion-badge color="light">{{ size | coreBytesToSize }}</ion-badge>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-button *ngIf="!removeFilesLoading" [disabled]="prefetchLoading" (click)="removeFiles()" color="danger" fill="clear"
|
<ion-button *ngIf="!removeFilesLoading" [disabled]="prefetchLoading" (click)="removeFiles()" color="danger" fill="clear"
|
||||||
[attr.aria-label]="'core.clearstoreddata' | translate:{$a: sizeReadable}" slot="end">
|
[attr.aria-label]="'core.clearstoreddata' | translate:{$a: size | coreBytesToSize}" slot="end">
|
||||||
<ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon>
|
<ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
<ion-spinner *ngIf="removeFilesLoading" slot="end" aria-hidden="true"></ion-spinner>
|
<ion-spinner *ngIf="removeFilesLoading" slot="end" aria-hidden="true"></ion-spinner>
|
||||||
|
|
|
@ -62,7 +62,7 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
|
||||||
prefetchLoading = false;
|
prefetchLoading = false;
|
||||||
canPrefetch = false;;
|
canPrefetch = false;;
|
||||||
prefetchDisabled = false;
|
prefetchDisabled = false;
|
||||||
sizeReadable = '';
|
size?: number; // Size in bytes
|
||||||
downloadTimeReadable = ''; // Last download time in a readable format.
|
downloadTimeReadable = ''; // Last download time in a readable format.
|
||||||
grades?: CoreGradesFormattedRow[];
|
grades?: CoreGradesFormattedRow[];
|
||||||
blog = false; // If blog is available.
|
blog = false; // If blog is available.
|
||||||
|
@ -137,7 +137,9 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
const moduleSize = await CoreCourseModulePrefetchDelegate.getModuleStoredSize(this.module, this.courseId);
|
const moduleSize = await CoreCourseModulePrefetchDelegate.getModuleStoredSize(this.module, this.courseId);
|
||||||
|
|
||||||
this.sizeReadable = moduleSize > 0 ? CoreTextUtils.bytesToSize(moduleSize, 2) : '';
|
if (moduleSize) {
|
||||||
|
this.size = moduleSize;
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
this.fileStatusObserver = CoreEvents.on(
|
this.fileStatusObserver = CoreEvents.on(
|
||||||
|
@ -211,9 +213,9 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
|
||||||
this.prefetchDisabled = moduleInfo.status == CoreConstants.DOWNLOADED;
|
this.prefetchDisabled = moduleInfo.status == CoreConstants.DOWNLOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sizeReadable = moduleInfo.size && moduleInfo.size > 0
|
if (moduleInfo.size && moduleInfo.size > 0) {
|
||||||
? moduleInfo.sizeReadable
|
this.size = moduleInfo.size;
|
||||||
: '';
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue