diff --git a/README.md b/README.md index 29ba488fb..fdcb9ec47 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ ## Swagger Generated Code To regnerate http rune swaagger ``` -URL=https://timo-redaction-dev.iqser.cloud/v2/api-docs?group=redaction-gateway-v1 +BASE=http://ingress.redaction-timo-dev-3011.178.63.47.73.xip.io/ +URL="$BASE"v2/api-docs?group=redaction-gateway-v1 mkdir -p /tmp/swagger swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger ``` diff --git a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html index 9423d219d..9c1f06864 100644 --- a/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/assign-owner-dialog/assign-owner-dialog.component.html @@ -3,17 +3,34 @@ class="dialog-header heading-l"> -
- - - - {{ userService.getNameForId(user.userId) }} - - - -
+
+
+ + + {{'assign-' + data.type + '-owner.dialog.single-user.label' | translate}} + + + {{userService.getNameForId(user.userId)}} + + + + + + {{'assign-' + data.type + '-owner.dialog.multi-user.label' | translate}} + + + {{userService.getNameForId(user.userId)}} + + + + +
+ +
+ +
+
- @@ -128,7 +128,7 @@
- 1 + {{ appStateService.activeProject.project.memberIds.length }}
@@ -155,13 +155,12 @@
-
+
- - - - +
+
+{{overflowCount}}
+
+
diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts index 9cad0d564..345a70df3 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts @@ -75,6 +75,14 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { return this.activeProject.memberIds.map(m => this._userService.getName(this._userService.getUserById(m))); } + public get displayMembers() { + return this.members.slice(0, 6); + } + + public get overflowCount() { + return this.members.length - 6; + } + public get ownerName() { return this._userService.getNameForId(this.activeProject.ownerId); } @@ -114,7 +122,15 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { } public openAssignProjectMembersDialog() { - this._dialogService.openAssignProjectMembersDialog(this.activeProject); + this._dialogService.openAssignProjectMembersDialog(this.activeProject, () => { + this._getFileStatus(); + }); + } + + public openAssignFileOwnerDialog($event: MouseEvent, file: FileStatus) { + this._dialogService.openAssignFileOwnerDialog($event, file, () => { + this._getFileStatus(); + }); } public reanalyseFile($event: MouseEvent, fileStatus: FileStatus) { @@ -149,14 +165,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { return fileStatus === 'PROCESSING' || fileStatus === 'REVIEWED' || true; } - public assignPeopleToFile($event: MouseEvent, fileStatus: FileStatus) { - $event.stopPropagation(); - this._statusControllerService.assignProjectOwner1(this.appStateService.activeProjectId, fileStatus.fileId, this.user.id).subscribe(() => { - this._notificationService.showToastNotification('Successfully assigned ' + this.user.name + ' to file: ' + fileStatus.filename); - }); - } - public getFileOwnerUsername(fileStatus: FileStatus) { - return undefined; + return this._userService.getNameForId(fileStatus.currentReviewer); } } diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 8038dab87..eae08b4d1 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -57,15 +57,15 @@ export class AppStateService { get isActiveProjectOwner() { - return this._appState.activeProject.project.ownerId === this._userService.userId + return this._appState.activeProject?.project?.ownerId === this._userService.userId } get isActiveProjectMember() { - return this._appState.activeProject.project.memberIds.indexOf(this._userService.userId) >= 0; + return this._appState.activeProject?.project?.memberIds?.indexOf(this._userService.userId) >= 0; } get isActiveFileDocumentReviewer() { - return false; + return this._appState.activeFile?.currentReviewer === this._userService.userId; } diff --git a/apps/red-ui/src/app/user/user.service.ts b/apps/red-ui/src/app/user/user.service.ts index d33d6626f..9cc8f1fb7 100644 --- a/apps/red-ui/src/app/user/user.service.ts +++ b/apps/red-ui/src/app/user/user.service.ts @@ -56,6 +56,10 @@ export class UserService { return this._allUsers; } + get managerUsers() { + return this._allUsers.filter(u => u.roles.indexOf('RED_MANAGER') >= 0); + } + async loadAllUsersIfNecessary() { if (!this._allUsers) { await this.loadAllUsers(); @@ -64,7 +68,7 @@ export class UserService { async loadAllUsers() { const allUsers = await this._userControllerService.getAllUsers({}, 0, 100).toPromise(); - this._allUsers = allUsers.users; + this._allUsers = allUsers.users.filter(u => this._hasAnyRedRole(u)); return allUsers; } @@ -100,4 +104,8 @@ export class UserService { isUser(user: User) { return user.roles.indexOf('RED_USER') >= 0; } + + private _hasAnyRedRole(u: User) { + return u.roles.indexOf('RED_USER') >= 0 || u.roles.indexOf('RED_MANAGER') >= 0 || u.roles.indexOf('RED_ADMIN') >= 0; + } } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index eede097e5..f5eeaa360 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -457,6 +457,38 @@ "label": "Unassigned" } }, + + "assign-file-owner":{ + "dialog": { + "single-user": { + "label": "Reviewer" + }, + "title":{ + "label": "Manage File Reviewer" + }, + "save": { + "label": "Save" + } + } + }, + + "assign-project-owner":{ + "dialog": { + "single-user": { + "label": "Owner" + }, + "multi-user": { + "label": "Members" + }, + "title":{ + "label": "Manage Project Owner and Members" + }, + "save": { + "label": "Save" + } + } + }, + "unassigned": "Unassigned", "under-review": "Under review", "under-approval": "Under approval", diff --git a/libs/red-ui-http/src/lib/api/projectController.service.ts b/libs/red-ui-http/src/lib/api/projectController.service.ts index 2c36d650a..a9d201669 100644 --- a/libs/red-ui-http/src/lib/api/projectController.service.ts +++ b/libs/red-ui-http/src/lib/api/projectController.service.ts @@ -257,15 +257,6 @@ export class ProjectControllerService { headers = headers.set('Accept', httpHeaderAcceptSelected); } - // to determine the Content-Type header - const consumes: string[] = [ - '*/*' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - return this.httpClient.request('delete', `${this.basePath}/project/members/${encodeURIComponent(String(projectId))}`, { body: body, diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 2f665a661..0a5deaa26 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -18,6 +18,10 @@ export interface FileStatus { * Date and time when the file was added to the system. */ added?: string; + /** + * The current reviewer's (if any) user id. + */ + currentReviewer?: string; /** * The ID of the file. */ diff --git a/package.json b/package.json index fa1f3e72c..ad33fe2f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redaction", - "version": "0.0.69", + "version": "0.0.70", "license": "MIT", "scripts": { "build-lint-all": "ng lint --project=red-ui-http --fix && ng build --project=red-ui-http && ng lint --project=red-ui --fix && ng build --project=red-ui --prod",