From 1f7359d4018106993a753c76d62aa4682c10c617 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Thu, 6 May 2021 22:29:26 +0300 Subject: [PATCH] fix project owner not reloading after change --- .../project-listing-actions.component.ts | 6 ++++-- .../assign-owner-dialog.component.ts | 5 +++-- .../project-listing-screen.component.html | 4 ++-- .../project-listing-screen.component.ts | 16 ++++++++++------ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts index eae6dd16d..2cdd569bc 100644 --- a/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/project-listing-actions/project-listing-actions.component.ts @@ -15,7 +15,7 @@ import { ProjectsDialogService } from '../../services/projects-dialog.service'; }) export class ProjectListingActionsComponent implements OnInit { @Input() project: ProjectWrapper; - @Output() actionPerformed = new EventEmitter(); + @Output() actionPerformed = new EventEmitter(); actionMenuOpen = false; constructor( @@ -28,7 +28,9 @@ export class ProjectListingActionsComponent implements OnInit { ngOnInit(): void {} public openAssignProjectOwnerDialog($event: MouseEvent, project: ProjectWrapper) { - this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project); + this._dialogService.openAssignProjectMembersAndOwnerDialog($event, project, (pw: ProjectWrapper) => { + this.actionPerformed.emit(pw); + }); } public openDeleteProjectDialog($event: MouseEvent, project: ProjectWrapper) { diff --git a/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts b/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts index 8862dcf97..dff977c46 100644 --- a/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts +++ b/apps/red-ui/src/app/modules/projects/dialogs/assign-owner-dialog/assign-owner-dialog.component.ts @@ -72,6 +72,7 @@ export class AssignOwnerDialogComponent { } async saveUsers() { + let result; try { if (this.data.type === 'project') { const ownerId = this.selectedSingleUser; @@ -79,7 +80,7 @@ export class AssignOwnerDialogComponent { const pw = Object.assign({}, this.data.project); pw.project.memberIds = memberIds; pw.project.ownerId = ownerId; - await this._appStateService.addOrUpdateProject(pw.project); + result = await this._appStateService.addOrUpdateProject(pw.project); } if (this.data.type === 'file') { @@ -102,7 +103,7 @@ export class AssignOwnerDialogComponent { this._notificationService.showToastNotification('Failed: ' + error.error ? error.error.message : error, null, NotificationType.ERROR); } - this.dialogRef.close(); + this.dialogRef.close(result); } get singleUsersSelectOptions() { diff --git a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html index 876a8e18b..2d6fa818a 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.html @@ -125,10 +125,10 @@
- +
- +
diff --git a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts index 298afcc19..ab82aa730 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/projects/screens/project-listing-screen/project-listing-screen.component.ts @@ -1,5 +1,5 @@ import { Component, Injector, OnDestroy, OnInit, ViewChild } from '@angular/core'; -import { Project, RuleSetModel } from '@redaction/red-ui-http'; +import { Project, RuleSetModel, User } from '@redaction/red-ui-http'; import { AppStateService } from '../../../../state/app-state.service'; import { UserService } from '../../../../services/user.service'; import { DoughnutChartConfig } from '../../../shared/components/simple-doughnut-chart/simple-doughnut-chart.component'; @@ -64,9 +64,9 @@ export class ProjectListingScreenComponent extends BaseListingComponent StatusSorter[a.key] - StatusSorter[b.key]); - this.documentsChartData = this.translateChartService.translateStatus(this.documentsChartData); + this.documentsChartData = this._translateChartService.translateStatus(this.documentsChartData); } public get user() { - return this.userService.user; + return this._userService.user; + } + + public getUser(id: string): User { + return this._userService.getUserById(id); } public get activeProjectsCount() { @@ -235,7 +239,7 @@ export class ProjectListingScreenComponent extends BaseListingComponent { peopleFilters.push({ key: userId, - label: this.userService.getNameForId(userId) + label: this._userService.getNameForId(userId) }); }); this.peopleFilters = processFilters(this.peopleFilters, peopleFilters);