Change device/folder getAll to getEach

This commit is contained in:
Jesse Lucas 2020-04-09 13:44:08 -04:00
parent f53475a204
commit 24a637e9e6
4 changed files with 14 additions and 10 deletions

View File

@ -4,7 +4,7 @@ import { ChartComponent } from './chart.component';
import { HttpClientModule } from '@angular/common/http';
class MockService {
getAll() {
getEach() {
// unimplemented
}
};

View File

@ -72,7 +72,7 @@ export class ChartComponent implements OnInit {
ngAfterViewInit() {
let totalCount: number = 0;
this.service.getAll().subscribe(
this.service.getEach().subscribe(
t => {
// Count the number of folders and set chart
totalCount++;

View File

@ -62,7 +62,10 @@ export class DeviceService {
});
}
getAll(): Observable<Device> {
/**
* getEach() returns each device
*/
getEach(): Observable<Device> {
const deviceObservable: Observable<Device> = new Observable((observer) => {
// TODO return devices if cached
@ -116,8 +119,8 @@ export class DeviceService {
}
)
},
err => { console.log("getAll error!", err) },
() => { console.log("get all complete!") }
err => { console.log("getEach error!", err) },
() => { console.log("getEach complete!") }
);
});
return deviceObservable

View File

@ -49,10 +49,11 @@ export class FolderService {
}
/**
* getAll() finds all folders and uses db status service to
* set all their statuses
* getEach() returns each folder and uses db status service to
* set all their statuses and db completion service to find
* completion
*/
getAll(): Observable<Folder> {
getEach(): Observable<Folder> {
// TODO return this.folders if cached
const folderObservable: Observable<Folder> = new Observable((observer) => {
@ -63,8 +64,8 @@ export class FolderService {
// Synchronously get the status of each folder
this.getFolderStatusInOrder(observer, 0);
},
err => { console.log("getAll error!", err) },
() => { console.log("get all complete!") }
err => { console.log("getEach error!", err) },
() => { console.log("getEach complete!") }
);
});
return folderObservable;