@@ -25,7 +23,7 @@
#dashboardTile
>
{{item.firstLine}}
-
{{item.title | slice:0:80}}
+
{{item.title | slice:0:80}}
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index 97ff21b988..fe1c6facad 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -1,9 +1,11 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
+
import { UserService } from '../shared/user.service';
import { CouchService } from '../shared/couchdb.service';
+
import { map, catchError, switchMap, auditTime, takeUntil } from 'rxjs/operators';
import { of, forkJoin, Subject, combineLatest } from 'rxjs';
import { findDocuments } from '../shared/mangoQueries';
@@ -16,12 +18,14 @@ import { CoursesViewDetailDialogComponent } from '../courses/view-courses/course
import { foundations, foundationIcons } from '../courses/constants';
import { CertificationsService } from '../manager-dashboard/certifications/certifications.service';
+
@Component({
templateUrl: './dashboard.component.html',
styleUrls: [ './dashboard.scss' ]
})
export class DashboardComponent implements OnInit, OnDestroy {
+
user = this.userService.get();
data = { resources: [], courses: [], meetups: [], myTeams: [] };
urlPrefix = environment.couchAddress + '/_users/org.couchdb.user:' + this.user.name + '/';
@@ -32,6 +36,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
badgeGroups = [ ...foundations, 'none' ];
badgeIcons = foundationIcons;
+
dateNow: any;
visits = 0;
surveysCount = 0;
@@ -40,16 +45,20 @@ export class DashboardComponent implements OnInit, OnDestroy {
onDestroy$ = new Subject
();
showBanner = false;
+
myLifeItems: any[] = [
{ firstLine: $localize`my`, title: $localize`Submissions`, link: 'submissions', authorization: 'leader,manager',
badge: this.examsCount },
+ { firstLine: $localize`my`, title: $localize`Progress`, link: 'myProgress' },
{ firstLine: $localize`my`, title: $localize`Personals`, link: 'myPersonals' },
{ firstLine: $localize`my`, title: $localize`Achievements`, link: 'myAchievements' },
{ firstLine: $localize`my`, title: $localize`Surveys`, link: 'mySurveys', badge: this.surveysCount },
- { firstLine: $localize`my`, title: $localize`Health`, link: 'myHealth' }
+ { firstLine: $localize`my`, title: $localize`Health`, link: 'myHealth' },
+ { firstLine: $localize`my`, title: $localize`Chat`, link: '/chat' }
];
cardTitles = { myLibrary: $localize`myLibrary`, myCourses: $localize`myCourses`, myTeams: $localize`myTeams`, myLife: $localize`myLife` };
+
constructor(
private userService: UserService,
private couchService: CouchService,
@@ -75,6 +84,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
+
ngOnInit() {
this.displayName = this.user.firstName !== undefined ? `${this.user.firstName} ${this.user.lastName}` : this.user.name;
this.planetName = this.stateService.configuration.name;
@@ -93,18 +103,22 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.reminderBanner();
}
+
ngOnDestroy() {
this.onDestroy$.next();
this.onDestroy$.complete();
}
+
initDashboard() {
+
const userShelf = this.userService.shelf;
if (this.isEmptyShelf(userShelf)) {
this.data = { resources: [], courses: [], meetups: [], myTeams: [] };
}
+
forkJoin([
this.getData('resources', userShelf.resourceIds, { linkPrefix: '/resources/view/', addId: true }),
this.getData('courses', userShelf.courseIds, { titleField: 'courseTitle', linkPrefix: '/courses/view/', addId: true }),
@@ -120,6 +134,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
+
getData(db: string, shelf: string[] = [], { linkPrefix, addId = false, titleField = 'title' }) {
return this.couchService.bulkGet(db, shelf.filter(id => id))
.pipe(
@@ -132,6 +147,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
);
}
+
getTeamMembership() {
const configuration = this.stateService.configuration;
return this.couchService.findAll(
@@ -149,6 +165,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
);
}
+
get profileImg() {
const attachments = this.user._attachments;
if (attachments) {
@@ -157,6 +174,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
return 'assets/image.png';
}
+
isEmptyShelf(shelf) {
return shelf.courseIds.length === 0
&& shelf.meetupIds.length === 0
@@ -164,6 +182,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
&& shelf.resourceIds.length === 0;
}
+
getSubmissions(type: string, status: string, username?: string) {
return this.submissionsService.getSubmissions(findDocuments({
type,
@@ -172,6 +191,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
}));
}
+
getSurveys() {
this.getSubmissions('survey', 'pending', this.user.name).subscribe((surveys) => {
this.surveysCount = dedupeObjectArray(surveys, [ 'parentId' ]).length;
@@ -179,6 +199,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
+
getExams() {
this.getSubmissions('exam', 'requires grading').subscribe((exams) => {
this.examsCount = exams.length;
@@ -186,10 +207,12 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
+
teamRemoved(team: any) {
this.data.myTeams = this.data.myTeams.filter(myTeam => team._id !== myTeam._id);
}
+
openCourseView(course: any) {
this.dialog.open(CoursesViewDetailDialogComponent, {
data: { courseId: course._id },
@@ -200,6 +223,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
+
setBadgesCourses(courses, certifications) {
this.badgesCourses = courses
.filter(course => course.progress.filter(step => step.passed === true).length === course.doc.steps.length
@@ -214,6 +238,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.badgeGroups = [ ...foundations, 'none' ].filter(group => this.badgesCourses[group] && this.badgesCourses[group].length);
}
+
reminderBanner() {
this.userService.isProfileComplete();
combineLatest([
@@ -224,9 +249,11 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
+
closeBanner() {
this.userService.profileBanner.next(false);
this.showBanner = false;
}
+
}
From 8dd9a5d22c12f089350db396c92cbeb525776979 Mon Sep 17 00:00:00 2001
From: Jesse Washburn <142361664+jessewashburn@users.noreply.github.com>
Date: Tue, 17 Dec 2024 13:08:30 -0500
Subject: [PATCH 2/3] spacing fix
---
.../dashboard/dashboard-tile.component.html | 2 +-
src/app/dashboard/dashboard.component.ts | 21 -------------------
2 files changed, 1 insertion(+), 22 deletions(-)
diff --git a/src/app/dashboard/dashboard-tile.component.html b/src/app/dashboard/dashboard-tile.component.html
index b4ad09eb7a..04bc066b5a 100644
--- a/src/app/dashboard/dashboard-tile.component.html
+++ b/src/app/dashboard/dashboard-tile.component.html
@@ -23,7 +23,7 @@
#dashboardTile
>
{{item.firstLine}}
- {{item.title | slice:0:80}}
+ {{item.title | slice:0:80}}
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index fe1c6facad..a8b5327758 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -1,11 +1,9 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
-
import { UserService } from '../shared/user.service';
import { CouchService } from '../shared/couchdb.service';
-
import { map, catchError, switchMap, auditTime, takeUntil } from 'rxjs/operators';
import { of, forkJoin, Subject, combineLatest } from 'rxjs';
import { findDocuments } from '../shared/mangoQueries';
@@ -18,14 +16,12 @@ import { CoursesViewDetailDialogComponent } from '../courses/view-courses/course
import { foundations, foundationIcons } from '../courses/constants';
import { CertificationsService } from '../manager-dashboard/certifications/certifications.service';
-
@Component({
templateUrl: './dashboard.component.html',
styleUrls: [ './dashboard.scss' ]
})
export class DashboardComponent implements OnInit, OnDestroy {
-
user = this.userService.get();
data = { resources: [], courses: [], meetups: [], myTeams: [] };
urlPrefix = environment.couchAddress + '/_users/org.couchdb.user:' + this.user.name + '/';
@@ -36,7 +32,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
badgeGroups = [ ...foundations, 'none' ];
badgeIcons = foundationIcons;
-
dateNow: any;
visits = 0;
surveysCount = 0;
@@ -45,7 +40,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
onDestroy$ = new Subject();
showBanner = false;
-
myLifeItems: any[] = [
{ firstLine: $localize`my`, title: $localize`Submissions`, link: 'submissions', authorization: 'leader,manager',
badge: this.examsCount },
@@ -58,7 +52,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
];
cardTitles = { myLibrary: $localize`myLibrary`, myCourses: $localize`myCourses`, myTeams: $localize`myTeams`, myLife: $localize`myLife` };
-
constructor(
private userService: UserService,
private couchService: CouchService,
@@ -84,7 +77,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
-
ngOnInit() {
this.displayName = this.user.firstName !== undefined ? `${this.user.firstName} ${this.user.lastName}` : this.user.name;
this.planetName = this.stateService.configuration.name;
@@ -103,16 +95,13 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.reminderBanner();
}
-
ngOnDestroy() {
this.onDestroy$.next();
this.onDestroy$.complete();
}
-
initDashboard() {
-
const userShelf = this.userService.shelf;
if (this.isEmptyShelf(userShelf)) {
this.data = { resources: [], courses: [], meetups: [], myTeams: [] };
@@ -134,7 +123,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
-
getData(db: string, shelf: string[] = [], { linkPrefix, addId = false, titleField = 'title' }) {
return this.couchService.bulkGet(db, shelf.filter(id => id))
.pipe(
@@ -147,7 +135,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
);
}
-
getTeamMembership() {
const configuration = this.stateService.configuration;
return this.couchService.findAll(
@@ -165,7 +152,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
);
}
-
get profileImg() {
const attachments = this.user._attachments;
if (attachments) {
@@ -174,7 +160,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
return 'assets/image.png';
}
-
isEmptyShelf(shelf) {
return shelf.courseIds.length === 0
&& shelf.meetupIds.length === 0
@@ -182,7 +167,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
&& shelf.resourceIds.length === 0;
}
-
getSubmissions(type: string, status: string, username?: string) {
return this.submissionsService.getSubmissions(findDocuments({
type,
@@ -199,7 +183,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
-
getExams() {
this.getSubmissions('exam', 'requires grading').subscribe((exams) => {
this.examsCount = exams.length;
@@ -212,7 +195,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.data.myTeams = this.data.myTeams.filter(myTeam => team._id !== myTeam._id);
}
-
openCourseView(course: any) {
this.dialog.open(CoursesViewDetailDialogComponent, {
data: { courseId: course._id },
@@ -223,7 +205,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
-
setBadgesCourses(courses, certifications) {
this.badgesCourses = courses
.filter(course => course.progress.filter(step => step.passed === true).length === course.doc.steps.length
@@ -238,7 +219,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.badgeGroups = [ ...foundations, 'none' ].filter(group => this.badgesCourses[group] && this.badgesCourses[group].length);
}
-
reminderBanner() {
this.userService.isProfileComplete();
combineLatest([
@@ -255,5 +235,4 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.showBanner = false;
}
-
}
From 33079fc9a00484a1d859eaa99a298ee6b5304909 Mon Sep 17 00:00:00 2001
From: Jesse Washburn <142361664+jessewashburn@users.noreply.github.com>
Date: Tue, 17 Dec 2024 13:09:44 -0500
Subject: [PATCH 3/3] spacing fix
---
src/app/dashboard/dashboard.component.ts | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index a8b5327758..c526917f9b 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -107,7 +107,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.data = { resources: [], courses: [], meetups: [], myTeams: [] };
}
-
forkJoin([
this.getData('resources', userShelf.resourceIds, { linkPrefix: '/resources/view/', addId: true }),
this.getData('courses', userShelf.courseIds, { titleField: 'courseTitle', linkPrefix: '/courses/view/', addId: true }),
@@ -175,7 +174,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
}));
}
-
getSurveys() {
this.getSubmissions('survey', 'pending', this.user.name).subscribe((surveys) => {
this.surveysCount = dedupeObjectArray(surveys, [ 'parentId' ]).length;
@@ -190,7 +188,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
-
teamRemoved(team: any) {
this.data.myTeams = this.data.myTeams.filter(myTeam => team._id !== myTeam._id);
}
@@ -229,7 +226,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
-
closeBanner() {
this.userService.profileBanner.next(false);
this.showBanner = false;