Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: fix offline queue
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleyzissou authored and wtrocki committed Feb 6, 2020
1 parent d39bb37 commit a5bd67e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
17 changes: 8 additions & 9 deletions src/app/pages/offline-queue/offline-queue.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,28 @@
</ion-header>

<ion-content class="outer-content">
<ion-list *ngIf="stagedItems">
<ion-item-group *ngFor="let key of Object.keys(stagedItems); let last = last"
<ion-list *ngIf="stagedTasks">
<ion-item-group *ngFor="let task of stagedTasks; let last = last"
[class.last-item]="last">
<ion-item>
<ion-label>
<h2>
Mutation type:
<ion-badge color="primary">
{{ stagedItems[key].operationName }}
{{ task.context.operationName }}
</ion-badge>
</h2>

<div *ngFor="let item of stagedItems[key].variables | keyvalue">
<ion-note>
<ul *ngIf="task.variables">
<li *ngFor="let item of task.variables | keyvalue">
{{ item.key }}: {{ item.value }}
</ion-note>
</div>
</li>
</ul>
</ion-label>
</ion-item>
</ion-item-group>
</ion-list>

<ion-grid class="queue-empty ion-justify-content-center" *ngIf="!stagedItems || stagedItems.length == 0">
<ion-grid class="queue-empty ion-justify-content-center" *ngIf="!stagedTasks || stagedTasks.length == 0">
<ion-row class="ion-justify-content-center">
<ion-col>
<ion-text color="medium">
Expand Down
14 changes: 7 additions & 7 deletions src/app/pages/offline-queue/offline-queue.page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ItemService } from '../../services/sync/item.service';
import { TaskService } from '../../services/sync/task.service';

@Component({
selector: 'app-offline-queue',
Expand All @@ -8,8 +8,8 @@ import { ItemService } from '../../services/sync/item.service';
})
export class OfflineQueuePage implements OnInit {
interval: number;
constructor(private itemService: ItemService) { }
stagedItems: any;
constructor(private taskService: TaskService) { }
stagedTasks: any;
Object = Object;

async ngOnInit() {
Expand All @@ -26,11 +26,11 @@ export class OfflineQueuePage implements OnInit {
}

private async fetchData() {
const tempItems = await this.itemService.getOfflineItems();
if (tempItems.length > 0) {
this.stagedItems = tempItems.map(taskItem => taskItem.operation );
const tempTasks = await this.taskService.getOfflineTasks();
if (tempTasks.length > 0) {
this.stagedTasks = tempTasks.map(task => task.operation.op);
} else {
this.stagedItems = [];
this.stagedTasks = [];
}
}
}

0 comments on commit a5bd67e

Please sign in to comment.