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KA,EAAEG,kBAErE,CACE3C,KAAM,+BACNqC,aAAc,IACZK,sDAAqDH,KAAKC,GAAKA,EAAEI,kBAErE,CACE5C,KAAM,iBACNqC,aAAc,IACZK,+DAA+DH,KAC7DC,GAAKA,EAAEK,uBAGb,CACE7C,KAAM,WACNqC,aAAc,IAAMC,+BAAmDC,KAAKC,GAAKA,EAAEM,gBAErF,CACE9C,KAAM,YACNqC,aAAc,IACZK,+DAAqDH,KAAKC,GAAKA,EAAEO,kBAErE,CACE/C,KAAM,8BACNqC,aAAc,IACZK,sDAAsFH,KACpFC,GAAKA,EAAEQ,kCAGb,CACEhD,KAAM,uBACNqC,aAAc,IACZK,uDAAwEH,KACtEC,GAAKA,EAAES,iCAajB,MAAOC,EAAqB5G,kDAArB4G,EAAqB,sCAArBA,IAAqB5G,wCAHtB6G,cAAsBnB,IACtBmB,wBC3DN,MAAOC,EAAc9G,kDAAd8G,EAAc,sCAAdA,IAAc9G,yCAFd,CAAC+G,MAASC,SAFXC,IAAcL,EAAuBM","names":["i0","ProjectContainerComponent","constructor","activatedRoute","appSessionService","apiService","toastMessagesService","loaderService","router","this","Subscription","ngOnInit","subscription","add","firstChild","paramMap","subscribe","paramsMap","projectId","get","isProjectLoaded","setCurrentProject","resetListTableStateForProject","loadProject","show","projects","getById","id","embed","response","hide","content","title","message","type","EToastMessageType","navigate","ngOnDestroy","unsubscribe","static","core","selectors","ctx_r22","ctx_r25","$event","ProjectsListComponent","SuperListComponent","injector","datePipe","dialogsService","super","EFilterType","tableListStateName","ETableList","loadData","isLoading","params","computedFields","apiRequestPrams","apiCallSubscription","pipe","finalize","setTableData","mapTableModel","map","project","TableItem","data","name","createdBy","fullName","transform","createdOn","totalReactions","totalRetrosynthesisRoutes","totalSynthesis","totalReactionCompletions","template","favoriteTemplate","actionsTemplate","mapTableHeaders","TableHeaderItem","metadata","property","sortingPriority","descending","sortable","sorted","style","width","toggleSorting","className","onRowClick","index","onAddToFavorites","isFavorite","post","path","projectsFavoritesChanges","next","onRemoveFromFavorites","request","method","onDeleteProject","dialog","open","OkCancelDialogComponent","okText","cancelText","okButtonType","afterClosed","closeEvent","status","EDialogCloseEventStatus","delete","_","onRenameProject","RenameDialogComponent","label","filter","tap","switchMap","patch","body","isBodyRaw","canRenameOrDelete","isOwner","auth","user","routes","redirectTo","pathMatch","component","children","loadChildren","__webpack_require__","then","m","ProjectDashboardModule","Promise","WorkspaceModule","ReactionsModule","RetrosynthesisModule","RoboRxnModule","SynthesisModule","ExperimentalProcedureTextModule","ReactionCompletionsModule","ProjectsRoutingModule","RouterModule","ProjectsModule","DatePipe","imports","SharedModule","ProjectsSharedModule"],"sourceRoot":"webpack:///","sources":["./src/app/modules/projects/project-container/project-container.component.html","./src/app/modules/projects/project-container/project-container.component.ts","./src/app/modules/projects/projects-list/projects-list.component.html","./src/app/modules/projects/projects-list/projects-list.component.ts","./src/app/modules/projects/projects-routing.module.ts","./src/app/modules/projects/projects.module.ts"],"sourcesContent":["<router-outlet *ngIf=\"isProjectLoaded\"></router-outlet>","import { Component, OnInit, OnDestroy } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { AppSessionService, ApiService, ToastMessagesService } from '@services';\nimport { IApiResponse } from '@bitf/api';\nimport { Project } from '@models';\nimport { EToastMessageType } from '@app/core/services/toast-messages/toast-message.enum';\nimport { LoaderService } from '@app/libs/bitforce/components';\nimport { Subscription } from 'rxjs';\n@Component({\n selector: 'ibm-project-container',\n templateUrl: './project-container.component.html',\n styleUrls: ['./project-container.component.scss'],\n})\nexport class ProjectContainerComponent implements OnInit, OnDestroy {\n private subscription = new Subscription();\n public isProjectLoaded = false;\n\n constructor(\n private activatedRoute: ActivatedRoute,\n private appSessionService: AppSessionService,\n private apiService: ApiService,\n private toastMessagesService: ToastMessagesService,\n private loaderService: LoaderService,\n private router: Router\n ) {}\n\n ngOnInit() {\n this.subscription.add(\n this.activatedRoute.firstChild.paramMap.subscribe(paramsMap => {\n const projectId = paramsMap.get('projectId');\n // reset current project\n this.isProjectLoaded = false;\n this.appSessionService.setCurrentProject(null);\n this.appSessionService.resetListTableStateForProject();\n this.loadProject(projectId);\n })\n );\n }\n\n loadProject(projectId) {\n this.loaderService.show();\n this.apiService.projects\n .getById<Project>({ id: projectId, embed: ['collaborators'] })\n .subscribe(\n (response: IApiResponse<Project>) => {\n this.loaderService.hide();\n this.appSessionService.setCurrentProject(response.content);\n this.isProjectLoaded = true;\n },\n () => {\n this.loaderService.hide();\n this.toastMessagesService.show({\n title: 'Error',\n message: `It looks like you don't have access to this project`,\n type: EToastMessageType.ERROR,\n });\n this.router.navigate(['/']);\n }\n );\n }\n\n ngOnDestroy() {\n this.subscription.unsubscribe();\n }\n}\n","<ibm-mlrp-header [hasSidenav]=\"true\">\n <ibm-header-global>\n <ibm-new-project-button></ibm-new-project-button>\n <ibm-user-overflow-menu></ibm-user-overflow-menu>\n </ibm-header-global>\n</ibm-mlrp-header>\n\n<div class=\"projects-list\">\n <h1 class=\"mb-5\">\n Project list <ibm-tag type=\"cool-gray\"\n *ngIf=\"totalItems > 0\">{{ totalItems }}</ibm-tag>\n </h1>\n <ibm-table-container *ngIf=\"isLoading || isSearching || tableItems.totalDataLength > 0\">\n <ibm-table-toolbar [model]=\"tableItems\"\n #toolbar>\n <ibm-table-toolbar-content>\n <ibm-search-bar (searchChange)=\"onSearch($event)\"\n placeholder=\"Search by name\"\n [searchData]=\"searchData\"></ibm-search-bar>\n <ibm-filters (filtersChange)=\"onFilter($event)\"\n [filters]=\"[eFilterType.DATE, eFilterType.FAVORITE]\"\n [filtersValues]=\"filters?.filtersValues\"></ibm-filters>\n </ibm-table-toolbar-content>\n </ibm-table-toolbar>\n <div *ngIf=\"tableItems.totalDataLength > 0 || isLoading\">\n <ibm-table [model]=\"tableItems\"\n [showSelectionColumn]=\"false\"\n [skeleton]=\"isLoading\"\n [striped]=\"false\"\n (rowClick)=\"onRowClick($event)\"\n (sort)=\"onSort($event)\"></ibm-table>\n <ibm-pagination [model]=\"tableItems\"\n [skeleton]=\"isLoading\"\n (selectPage)=\"onSelectPage($event)\"\n [itemsPerPageOptions]=\"itemsPerPageOptions\"\n class=\"bt-none\"></ibm-pagination>\n </div>\n <ibm-no-items-found *ngIf=\"tableItems.totalDataLength === 0 && isSearching && !isLoading\"\n message=\"No results match your search criteria\"></ibm-no-items-found>\n </ibm-table-container>\n <ibm-no-items-found *ngIf=\"tableItems.totalDataLength === 0 && !isLoading && !isSearching\"\n message=\"You don't have any projects yet\"></ibm-no-items-found>\n</div>\n\n<div class=\"d-none\"\n *ngFor=\"let item of items\"\n data-e2e=\"lastModified\">{{item.modifiedOn}}</div>\n\n<ng-template #favoriteTemplate\n let-data=\"data\">\n <div class=\"d-flex align-items-center\">\n <button class=\"bx--btn bx--btn--ghost\"\n (click)=\"onAddToFavorites(data); $event.stopPropagation();\"\n *ngIf=\"!data.isFavorite\">\n <svg icon\n ibmIconStar\n size=\"16\"></svg>\n </button>\n <button class=\"bx--btn bx--btn--ghost\"\n (click)=\"onRemoveFromFavorites(data); $event.stopPropagation();\"\n *ngIf=\"data.isFavorite\">\n <svg icon\n ibmIconStarFilled\n size=\"16\"\n class=\"fill-interactive\"></svg>\n </button>\n </div>\n</ng-template>\n<ng-template #actionsTemplate\n let-data=\"data\">\n <div class=\"d-flex align-items-center\">\n <ibm-overflow-menu (click)=\"$event.stopPropagation()\"\n [flip]=\"true\">\n <ibm-overflow-menu-option [routerLink]=\"['..', data.id, data.name, 'retrosynthesis']\">\n Retrosynthesis\n </ibm-overflow-menu-option>\n <ibm-overflow-menu-option [routerLink]=\"['..', data.id, data.name, 'forward-reaction-predictions']\">\n Products predictions\n </ibm-overflow-menu-option>\n <ibm-overflow-menu-option [routerLink]=\"['..', data.id, data.name, 'synthesis', 'executions']\">\n Synthesis executions\n </ibm-overflow-menu-option>\n <ibm-overflow-menu-option [routerLink]=\"['..', data.id, data.name, 'synthesis', 'procedures']\">\n Synthesis procedures\n </ibm-overflow-menu-option>\n <ibm-overflow-menu-option [routerLink]=\"['..', data.id, data.name, 'reaction-completions']\">\n Reagents predictions\n </ibm-overflow-menu-option>\n <ibm-overflow-menu-option *ngIf=\"canRenameOrDelete(data)\"\n [divider]=\"true\"\n (click)=\"onRenameProject(data)\">\n Rename\n </ibm-overflow-menu-option>\n <ibm-overflow-menu-option *ngIf=\"canRenameOrDelete(data)\"\n type=\"danger\"\n (click)=\"onDeleteProject(data)\">\n Delete\n </ibm-overflow-menu-option>\n </ibm-overflow-menu>\n </div>\n</ng-template>","import { Component, Injector, TemplateRef, ViewChild } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { filter, finalize, switchMap, tap } from 'rxjs/operators';\nimport { TableHeaderItem, TableItem } from 'carbon-components-angular';\n\nimport { IApiRequest } from '@app/libs/bitforce/api';\nimport { LoaderService } from '@app/libs/bitforce/components';\n\nimport { ETableList } from '@app/shared/enums/table-list.enum';\nimport { Project, User } from '@app/core/models';\nimport { DialogsService } from '@app/core/services';\nimport { IDialogCloseEvent, IOkCancelDialogData } from '@app/core/services/dialog/dialog.interface';\nimport { EDialogCloseEventStatus } from '@app/core/services/dialog/dialog.enum';\nimport { OkCancelDialogComponent } from '@app/shared/components/ok-cancel-dialog/ok-cancel-dialog.component';\nimport { EToastMessageType } from '@app/core/services/toast-messages/toast-message.enum';\nimport { EFilterType } from '@app/shared/enums/filters.enum';\nimport { SuperListComponent } from '@app/shared/components/super-list/super-list.component';\nimport { RenameDialogComponent } from '@app/shared/components/rename-dialog/rename-dialog.component';\n\n@Component({\n selector: 'ibm-projects-list',\n templateUrl: './projects-list.component.html',\n styleUrls: ['./projects-list.component.scss'],\n})\nexport class ProjectsListComponent extends SuperListComponent<Project> {\n @ViewChild('actionsTemplate', { static: false })\n protected actionsTemplate: TemplateRef<any>;\n @ViewChild('favoriteTemplate', { static: false })\n protected favoriteTemplate: TemplateRef<any>;\n private projects: Project[] = [];\n public eFilterType = EFilterType;\n\n constructor(\n public injector: Injector,\n private datePipe: DatePipe,\n private dialogsService: DialogsService,\n private loaderService: LoaderService\n ) {\n super(injector);\n this.tableListStateName = ETableList.PROJECTS_LIST;\n }\n\n protected loadData() {\n this.isLoading = true;\n const params: IApiRequest = {\n computedFields: [\n 'totalReactions',\n 'totalSynthesis',\n 'totalRetrosynthesisRoutes',\n 'totalReactionCompletions',\n ],\n embed: ['createdBy'],\n ...this.apiRequestPrams,\n };\n\n this.apiCallSubscription.unsubscribe();\n this.apiCallSubscription = this.apiService.projects\n .get<Project>(params)\n .pipe(\n finalize(() => {\n this.isLoading = false;\n })\n )\n .subscribe(response => {\n this.setTableData(response);\n this.projects = response.content;\n });\n }\n\n protected mapTableModel(projects: Project[]): TableItem[][] {\n return projects.map(project => [\n new TableItem({ data: project.name }),\n new TableItem({\n data: (project.createdBy as User).fullName,\n }),\n new TableItem({\n data: this.datePipe.transform(project.createdOn, 'yyyy-MM-dd'),\n }),\n new TableItem({\n data: project.totalReactions,\n }),\n new TableItem({\n data: project.totalRetrosynthesisRoutes,\n }),\n new TableItem({\n data: project.totalSynthesis,\n }),\n new TableItem({\n data: project.totalReactionCompletions,\n }),\n new TableItem({\n data: project,\n template: this.favoriteTemplate,\n }),\n new TableItem({\n data: project,\n template: this.actionsTemplate,\n }),\n ]);\n }\n\n protected mapTableHeaders(): TableHeaderItem[] {\n return [\n new TableHeaderItem({\n data: 'Name',\n metadata: { property: 'name', sortingPriority: 1 },\n descending: true,\n }),\n new TableHeaderItem({ data: 'Owner', sortable: false }),\n new TableHeaderItem({\n data: 'Creation date',\n metadata: { property: 'createdOn', sortingPriority: 2 },\n sorted: true,\n descending: true,\n }),\n new TableHeaderItem({ data: 'Products', sortable: false }),\n new TableHeaderItem({ data: 'Retrosynthetic routes', sortable: false }),\n new TableHeaderItem({ data: 'Synthesis', sortable: false }),\n new TableHeaderItem({ data: 'Reagents', sortable: false }),\n new TableHeaderItem({\n data: '',\n sorted: true,\n descending: true,\n style: { width: '2rem' },\n metadata: { property: 'favorite', toggleSorting: true, sortingPriority: 0 },\n className: 'favorite-header-cell',\n }),\n new TableHeaderItem({\n data: '',\n style: { width: '2rem' },\n sortable: false,\n }),\n ];\n }\n\n onRowClick(index) {\n this.router.navigate(['projects', this.projects[index].id, this.projects[index].name, 'dashboard']);\n }\n\n onAddToFavorites(project: Project) {\n project.isFavorite = !project.isFavorite; // optimistic update\n this.apiService.projects\n .post({\n path: `${project.id}/favorite`,\n })\n .subscribe(\n () => {\n this.appSessionService.projectsFavoritesChanges.next();\n },\n () => {\n project.isFavorite = !project.isFavorite;\n this.toastMessagesService.show({\n title: 'Project favorite',\n message: 'Error on add project to favorites',\n type: EToastMessageType.ERROR,\n });\n }\n );\n }\n\n onRemoveFromFavorites(project: Project) {\n project.isFavorite = !project.isFavorite; // optimistic update\n this.apiService.projects\n .request({\n path: `${project.id}/favorite`,\n method: 'DELETE',\n })\n .subscribe(\n () => {\n this.appSessionService.projectsFavoritesChanges.next();\n },\n () => {\n project.isFavorite = !project.isFavorite;\n this.toastMessagesService.show({\n title: 'Project favorite',\n message: 'Error on remove project from favorites',\n type: EToastMessageType.ERROR,\n });\n }\n );\n }\n\n onDeleteProject(project: Project) {\n this.dialogsService.dialog\n .open(OkCancelDialogComponent, {\n title: `Are you sure you want to delete the project ${project.name}?`,\n // eslint-disable-next-line max-len\n message: `You'll delete all the attempts and reaction collections, all collaborators will loose the access to the project`,\n okText: 'Delete',\n cancelText: 'Cancel',\n okButtonType: 'danger--primary',\n } as IOkCancelDialogData)\n .afterClosed()\n .subscribe((closeEvent: IDialogCloseEvent<Project>) => {\n if (closeEvent.status === EDialogCloseEventStatus.OK) {\n this.apiService.projects.delete(project).subscribe(\n _ => {\n this.toastMessagesService.show({\n title: 'Project delete',\n message: 'Project has been deleted',\n type: EToastMessageType.SUCCESS,\n });\n\n if (project.isFavorite) {\n this.appSessionService.projectsFavoritesChanges.next();\n }\n\n this.loadData();\n },\n () => {\n this.toastMessagesService.show({\n title: 'Project delete',\n message: 'Error on project delete',\n type: EToastMessageType.ERROR,\n });\n }\n );\n }\n });\n }\n\n onRenameProject(project: Project) {\n this.dialogsService.dialog\n .open(RenameDialogComponent, {\n title: 'Rename Project',\n label: 'Change the project name',\n name: project.name,\n })\n .afterClosed()\n .pipe(\n filter((closeEvent: IDialogCloseEvent<string>) => closeEvent.status === EDialogCloseEventStatus.OK),\n tap(_ => this.loaderService.show()),\n switchMap((closeEvent: IDialogCloseEvent<string>) =>\n this.apiService.projects.patch<Project>({\n body: {\n id: project.id,\n name: closeEvent.data,\n },\n isBodyRaw: true,\n })\n ),\n finalize(() => this.loaderService.hide())\n )\n .subscribe(\n _ => {\n this.loadData();\n this.toastMessagesService.show({\n title: 'Rename project',\n message: 'Project has been renamed',\n type: EToastMessageType.SUCCESS,\n });\n },\n () => {\n this.toastMessagesService.show({\n title: 'Rename project - failed',\n message: 'Project has not been renamed',\n type: EToastMessageType.ERROR,\n });\n }\n );\n }\n\n canRenameOrDelete(project: Project): boolean {\n return project.isOwner(this.apiService.auth.user);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\n\nimport { ProjectContainerComponent } from '@app/modules/projects/project-container/project-container.component';\nimport { ProjectsListComponent } from '@modules/projects/projects-list/projects-list.component';\n\nconst routes: Routes = [\n { path: '', redirectTo: 'list', pathMatch: 'full' },\n {\n path: 'list',\n component: ProjectsListComponent,\n },\n {\n path: '',\n component: ProjectContainerComponent,\n children: [\n {\n path: ':projectId/:projectName',\n children: [\n { path: '', redirectTo: 'dashboard', pathMatch: 'full' },\n {\n path: 'dashboard',\n loadChildren: () =>\n import('src/app/modules/projects/project-dashboard/project-dashboard.module').then(\n m => m.ProjectDashboardModule\n ),\n },\n {\n path: 'workspace',\n loadChildren: () =>\n import('src/app/modules/workspace/workspace.module').then(m => m.WorkspaceModule),\n },\n {\n path: 'forward-reaction-predictions',\n loadChildren: () =>\n import('src/app/modules/reactions/reactions.module').then(m => m.ReactionsModule),\n },\n {\n path: 'retrosynthesis',\n loadChildren: () =>\n import('src/app/modules/retrosynthesis/retrosynthesis.module').then(\n m => m.RetrosynthesisModule\n ),\n },\n {\n path: 'robo-rxn',\n loadChildren: () => import('src/app/modules/robo-rxn/robo-rxn.module').then(m => m.RoboRxnModule),\n },\n {\n path: 'synthesis',\n loadChildren: () =>\n import('src/app/modules/synthesis/synthesis.module').then(m => m.SynthesisModule),\n },\n {\n path: 'experimental-procedure-text',\n loadChildren: () =>\n import('@app/modules/experimental-procedure-text/experimental-procedure-text.module').then(\n m => m.ExperimentalProcedureTextModule\n ),\n },\n {\n path: 'reaction-completions',\n loadChildren: () =>\n import('@app/modules/reaction-completions/reaction-completions.module').then(\n m => m.ReactionCompletionsModule\n ),\n },\n ],\n },\n ],\n },\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class ProjectsRoutingModule {}\n","import { NgModule } from '@angular/core';\nimport { DatePipe } from '@angular/common';\n\nimport { SharedModule } from '@shared/shared.module';\nimport { ProjectsRoutingModule } from '@modules/projects/projects-routing.module';\n\nimport { ProjectsSharedModule } from '@modules/projects/projects-shared/projects-shared.module';\n\nimport { ProjectContainerComponent } from '@app/modules/projects/project-container/project-container.component';\nimport { ProjectsListComponent } from '@modules/projects/projects-list/projects-list.component';\n\n@NgModule({\n imports: [SharedModule, ProjectsRoutingModule, ProjectsSharedModule],\n declarations: [ProjectContainerComponent, ProjectsListComponent],\n providers: [DatePipe],\n})\nexport class ProjectsModule {}\n"],"x_google_ignoreList":[]}