Skip to content

Commit

Permalink
Fix a few small bugs (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnchartedBull committed Mar 22, 2021
1 parent bdc8fce commit c26a901
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
8 changes: 5 additions & 3 deletions src/app/files/files.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
</span>
</div>

<div class="files">
<ng-lottie [hidden]="loading === 0" id="loadingAnimation" [options]="loadingOptions"></ng-lottie>
<div class="files" *ngIf="loading !== 0">
<ng-lottie id="loadingAnimation" [options]="loadingOptions"></ng-lottie>
</div>

<div class="files" *ngIf="loading === 0">
<div *ngIf="!directory" class="files__error">can't load files ...</div>

<div *ngIf="directory">
Expand All @@ -50,7 +52,7 @@
<img src="assets/folder.svg" class="files__icon" />
<div class="files__info">
<span class="files__info-value">
{{ folder.size }} <span class="files__info-unit" *ngIf="folder.size > 0">mb</span>
{{ folder.size }} <span class="files__info-unit" *ngIf="folder.size !== undefined">mb</span>
</span>
</div>
<span class="files__name">
Expand Down
1 change: 1 addition & 0 deletions src/app/files/files.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class FilesComponent {
}

public openFolder(folderPath: string): void {
folderPath = folderPath === '' ? '/' : folderPath;
setTimeout((): void => {
this.showLoader();
this.directory = { files: [], folders: [] };
Expand Down
29 changes: 16 additions & 13 deletions src/app/services/files/files.octoprint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class FilesOctoprintService implements FilesService {
origin: fileOrFolder.origin,
path: '/' + fileOrFolder.origin + '/' + fileOrFolder.path,
name: fileOrFolder.name,
date: this.conversionService.convertDateToString(new Date(fileOrFolder.date * 1000)),
date: this.conversionService.convertDateToString(new Date(fileOrFolder.date)),
size: this.conversionService.convertByteToMegabyte(fileOrFolder.size),
...(fileOrFolder.gcodeAnalysis
? {
Expand Down Expand Up @@ -84,18 +84,21 @@ export class FilesOctoprintService implements FilesService {
);

if (localCount > 0 && sdCardCount > 0) {
directory.folders.push({
origin: 'local',
path: '/local',
name: 'local',
size: `${localCount} files`,
} as Folder);
directory.folders.push({
origin: 'sdcard',
path: '/sdcard',
name: 'sdcard',
size: `${localCount} files`,
} as Folder);
directory.folders = [
{
origin: 'local',
path: '/local',
name: 'local',
size: undefined,
},
{
origin: 'sdcard',
path: '/sdcard',
name: 'sdcard',
size: undefined,
},
];
directory.files = [];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/services/socket/socket.octoprint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class OctoPrintSocketService implements SocketService {
private http: HttpClient,
) {
this.printerStatusSubject = new ReplaySubject<PrinterStatus>();
this.jobStatusSubject = new ReplaySubject<JobStatus>();
this.jobStatusSubject = new Subject<JobStatus>();
this.eventSubject = new ReplaySubject<PrinterEvent>();
}

Expand Down

0 comments on commit c26a901

Please sign in to comment.