Commit 56dfa91a authored by Juan Manuel Solaro's avatar Juan Manuel Solaro

(feat) ability to count scheduled activities

1 merge request!494WIP: epic/post-scheduler
Pipeline #77592138 running with stages
......@@ -9,7 +9,7 @@
<div class="mindsList__tools m-border">
<div class="mindsListTools__scheduled" (click)="toggleScheduled()" [class.selected]="seeScheduled">
<m-tooltip icon="date_range"> See Scheduled Activities </m-tooltip>
<span>scheduled: 10</span>
<span>scheduled: {{scheduledCount}}</span>
</div>
<m-sort-selector
class="m-channel--sorted__SortSelector"
......
......@@ -14,6 +14,7 @@ import { Session } from "../../../services/session";
import { PosterComponent } from "../../newsfeed/poster/poster.component";
import { SortedService } from "./sorted.service";
import { ClientMetaService } from "../../../common/services/client-meta.service";
import { Client } from "../../../services/api";
@Component({
selector: 'm-channel--sorted',
......@@ -68,6 +69,8 @@ export class ChannelSortedComponent implements OnInit {
@ViewChild('poster', { static: false }) protected poster: PosterComponent;
scheduledCount: number = 0;
constructor(
public feedsService: FeedsService,
protected service: SortedService,
......@@ -75,6 +78,7 @@ export class ChannelSortedComponent implements OnInit {
protected clientMetaService: ClientMetaService,
@SkipSelf() injector: Injector,
protected cd: ChangeDetectorRef,
public client: Client
) {
this.clientMetaService
.inherit(injector)
......@@ -110,6 +114,8 @@ export class ChannelSortedComponent implements OnInit {
.setLimit(12)
.fetch();
this.getScheduledCount();
} catch (e) {
console.error('ChannelsSortedComponent.load', e);
}
......@@ -185,4 +191,11 @@ export class ChannelSortedComponent implements OnInit {
this.seeScheduled = !this.seeScheduled;
this.load(true);
}
async getScheduledCount() {
const url = `api/v2/channel/scheduled/${this.channel.guid}/count`;
const response: any = await this.client.get(url);
this.scheduledCount = response.count;
this.detectChanges();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment