-
-
-
diff --git a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts
index 8247f709c..f1eaf8942 100644
--- a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts
+++ b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.ts
@@ -1,16 +1,17 @@
-import {Component, OnInit} from '@angular/core';
-import {Project, ProjectControllerService} from '@redaction/red-ui-http';
-import {MatDialog} from '@angular/material/dialog';
-import {AddEditProjectDialogComponent} from './add-edit-project-dialog/add-edit-project-dialog.component';
-import {ConfirmationDialogComponent} from '../../common/confirmation-dialog/confirmation-dialog.component';
-import {TranslateService} from '@ngx-translate/core';
-import {NotificationService} from '../../notification/notification.service';
-import {AppStateService, ProjectWrapper} from '../../state/app-state.service';
-import {UserService} from '../../user/user.service';
-import {ProjectDetailsDialogComponent} from '../project-overview-screen/project-details-dialog/project-details-dialog.component';
-import {DoughnutChartConfig} from '../../components/simple-doughnut-chart/simple-doughnut-chart.component';
-import {SortingOption} from '../../utils/types';
-import {groupBy} from "../../utils/functions";
+import { Component, OnInit } from '@angular/core';
+import { Project, ProjectControllerService } from '@redaction/red-ui-http';
+import { MatDialog } from '@angular/material/dialog';
+import { AddEditProjectDialogComponent } from './add-edit-project-dialog/add-edit-project-dialog.component';
+import { ConfirmationDialogComponent } from '../../common/confirmation-dialog/confirmation-dialog.component';
+import { TranslateService } from '@ngx-translate/core';
+import { NotificationService } from '../../notification/notification.service';
+import { AppStateService, ProjectWrapper } from '../../state/app-state.service';
+import { UserService } from '../../user/user.service';
+import { ProjectDetailsDialogComponent } from '../project-overview-screen/project-details-dialog/project-details-dialog.component';
+import { DoughnutChartConfig } from '../../components/simple-doughnut-chart/simple-doughnut-chart.component';
+import { SortingOption } from '../../utils/types';
+import { groupBy } from '../../utils/functions';
+import { AssignOwnerDialogComponent } from '../../components/project-members-dialog/assign-owner-dialog.component';
@Component({
selector: 'redaction-project-listing-screen',
@@ -21,8 +22,8 @@ export class ProjectListingScreenComponent implements OnInit {
public projectsChartData: DoughnutChartConfig [] = [];
public documentsChartData: DoughnutChartConfig [] = [];
public sortingOptions: SortingOption[] = [
- {label: 'project-listing.sorting.recent.label', order: 'desc', column: 'projectDate'},
- {label: 'project-listing.sorting.alphabetically.label', order: 'asc', column: 'project.projectName'}
+ { label: 'project-listing.sorting.recent.label', order: 'desc', column: 'projectDate' },
+ { label: 'project-listing.sorting.alphabetically.label', order: 'asc', column: 'project.projectName' }
];
public sortingOption: SortingOption = this.sortingOptions[0];
@@ -35,25 +36,49 @@ export class ProjectListingScreenComponent implements OnInit {
private readonly _dialog: MatDialog) {
}
- get user() {
- return this._userService.user;
- }
-
ngOnInit(): void {
this.appStateService.reset();
this.projectsChartData = [
- {value: this.activeProjects, color: 'ACTIVE', label: 'active'},
- {value: this.inactiveProjects, color: 'DELETED', label: 'archived'}
+ { value: this.activeProjects, color: 'ACTIVE', label: 'active' },
+ { value: this.inactiveProjects, color: 'DELETED', label: 'archived' }
];
const groups = groupBy(this.appStateService.aggregatedFiles, 'status');
this.documentsChartData = [];
for (const key of Object.keys(groups)) {
- this.documentsChartData.push({value: groups[key].length, color: key, label: key});
+ this.documentsChartData.push({ value: groups[key].length, color: key, label: key });
}
}
- openAddProjectDialog(project?: Project): void {
+ public get user() {
+ return this._userService.user;
+ }
+
+ public get totalPages() {
+ return this.appStateService.totalAnalysedPages;
+ }
+
+ public get totalPeople() {
+ return this.appStateService.totalPeople;
+ }
+
+ public get activeProjects() {
+ return this.appStateService.allProjects.reduce((i, p) => i + (p.project.status === Project.StatusEnum.ACTIVE ? 1 : 0), 0);
+ }
+
+ public get inactiveProjects() {
+ return this.appStateService.allProjects.length - this.activeProjects;
+ }
+
+ public documentCount(project: ProjectWrapper) {
+ return project.files.length;
+ }
+
+ public userCount(project: ProjectWrapper) {
+ return 1;
+ }
+
+ public openAddProjectDialog(project?: Project): void {
this._dialog.open(AddEditProjectDialogComponent, {
width: '400px',
maxWidth: '90vw',
@@ -61,12 +86,7 @@ export class ProjectListingScreenComponent implements OnInit {
});
}
- editProject($event: MouseEvent, project: Project) {
- $event.stopPropagation();
- this.openAddProjectDialog(project);
- }
-
- deleteProject($event: MouseEvent, project: Project) {
+ public openDeleteProjectDialog($event: MouseEvent, project: Project) {
$event.stopPropagation();
const dialogRef = this._dialog.open(ConfirmationDialogComponent, {
width: '400px',
@@ -80,7 +100,7 @@ export class ProjectListingScreenComponent implements OnInit {
});
}
- showDetailsDialog($event: MouseEvent, project: ProjectWrapper) {
+ public openDetailsDialog($event: MouseEvent, project: ProjectWrapper) {
$event.stopPropagation();
this._dialog.open(ProjectDetailsDialogComponent, {
width: '600px',
@@ -89,34 +109,12 @@ export class ProjectListingScreenComponent implements OnInit {
});
}
- get totalPages() {
- return this.appStateService.totalAnalysedPages;
- }
-
- get totalPeople(){
- return this.appStateService.totalPeople;
- }
-
- documentCount(project: ProjectWrapper) {
- return project.files.length;
- }
-
- userCount(project: ProjectWrapper) {
- return 1;
- }
-
- get activeProjects() {
- return this.appStateService.allProjects.reduce((i, p) => i + (p.project.status === Project.StatusEnum.ACTIVE ? 1 : 0), 0);
- }
-
- get inactiveProjects() {
- return this.appStateService.allProjects.length - this.activeProjects;
- }
-
- assignProjectPeople($event: MouseEvent, project: Project) {
+ public openAssignProjectOwnerDialog($event: MouseEvent, project: Project) {
$event.stopPropagation();
- this._projectControllerService.assignProjectOwner(project.projectId, this._userService.user.id).subscribe(() => {
- this._notificationService.showToastNotification("Successfully assigned " + this.user.name + " to project: " + project.projectName);
- })
+ this._dialog.open(AssignOwnerDialogComponent, {
+ width: '400px',
+ maxWidth: '90vw',
+ data: { type: 'project', projectId: project.projectId }
+ });
}
}
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.html b/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.html
new file mode 100644
index 000000000..b9eec293f
--- /dev/null
+++ b/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ {{ userService.getNameForId(user.userId) }}
+
+
+
+
+
+
+
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.scss b/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.ts
new file mode 100644
index 000000000..272784e9a
--- /dev/null
+++ b/apps/red-ui/src/app/screens/project-overview-screen/project-members-dialog/assign-project-members-dialog.component.ts
@@ -0,0 +1,56 @@
+import { Component, Inject } from '@angular/core';
+import { Project, ProjectControllerService } from '@redaction/red-ui-http';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { AppStateService, ProjectWrapper } from '../../../state/app-state.service';
+import { UserService } from '../../../user/user.service';
+import { MatSelectionListChange } from '@angular/material/list';
+import { NotificationService, NotificationType } from '../../../notification/notification.service';
+
+@Component({
+ selector: 'redaction-project-details-dialog',
+ templateUrl: './assign-project-members-dialog.component.html',
+ styleUrls: ['./assign-project-members-dialog.component.scss']
+})
+export class AssignProjectMembersDialogComponent {
+ private _project: Project;
+ public memberIds: string[];
+
+ constructor(private readonly _projectControllerService: ProjectControllerService,
+ private readonly _notificationService: NotificationService,
+ public readonly userService: UserService,
+ private readonly _appStateService: AppStateService,
+ public dialogRef: MatDialogRef
) {
+ this._loadProject();
+ }
+
+ private _loadProject() {
+ this._project = this._appStateService.activeProject.project;
+ this.memberIds = [...this._project.memberIds];
+ }
+
+ private _reloadProject() {
+ this._appStateService.addOrUpdateProject(this._project).then(() => {
+ this._loadProject();
+ });
+ }
+
+ public selectionChange($event: MatSelectionListChange) {
+ const userId = $event.option.value;
+ const selected = $event.option.selected;
+ const userName = this.userService.getNameForId(userId);
+
+ if (selected) {
+ this._projectControllerService.addMembersToProject({ memberIds: [userId] }, this._project.projectId).subscribe(() => {
+ this._notificationService.showToastNotification('Successfully assigned ' + userName + ' to project: ' + this._project.projectName);
+ }, error => {
+ this._notificationService.showToastNotification('Failed: ' + error.error.message, null, NotificationType.ERROR);
+ }).add(() => this._reloadProject());
+ } else {
+ this._projectControllerService.deleteMembersToProject({ memberIds: [userId] }, this._project.projectId).subscribe(() => {
+ this._notificationService.showToastNotification('Successfully removed ' + userName + ' from project: ' + this._project.projectName);
+ }, error => {
+ this._notificationService.showToastNotification('Failed: ' + error.error.message, null, NotificationType.ERROR);
+ }).add(() => this._reloadProject());
+ }
+ }
+}
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html
index e03aa8716..d2502aa14 100644
--- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html
+++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html
@@ -1,5 +1,5 @@
+ [routerLink]="canOpenFile(fileStatus.status) ? ['/ui/projects/'+activeProject.projectId+'/file/'+fileStatus.fileId] : []">
{{ fileStatus.filename }}
@@ -77,7 +77,7 @@
@@ -88,7 +88,7 @@