OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#45214] added success notification after creating file links
Eric Schubertdd029fff27f3
diff --git a/frontend/src/app/core/state/file-links/file-links.service.ts b/frontend/src/app/core/state/file-links/file-links.service.tsindex 5d6edbdbea5..5a2875ce0fe 100644--- a/frontend/src/app/core/state/file-links/file-links.service.ts+++ b/frontend/src/app/core/state/file-links/file-links.service.ts@@ -29,7 +29,7 @@import { applyTransaction } from '@datorama/akita';import { Injectable } from '@angular/core';import { HttpHeaders } from '@angular/common/http';-import { from } from 'rxjs';+import { from, Observable } from 'rxjs';import {groupBy,mergeMap,@@ -100,7 +100,12 @@ export class FileLinksResourceService extends ResourceCollectionService<IFileLin);}- addFileLinks(collectionKey:string, addFileLinksHref:string, storage:IHalResourceLink, filesToLink:IStorageFile[]):void {+ addFileLinks(+ collectionKey:string,+ addFileLinksHref:string,+ storage:IHalResourceLink,+ filesToLink:IStorageFile[],+ ):Observable<IHALCollection<IFileLink>> {const elements = filesToLink.map((file) => ({originData: {id: file.id,@@ -115,10 +120,10 @@ export class FileLinksResourceService extends ResourceCollectionService<IFileLin_links: { storage },}));- this.http+ return this.http.post<IHALCollection<IFileLink>>(addFileLinksHref, { _type: 'Collection', _embedded: { elements } })- .subscribe(- (collection) => {+ .pipe(+ tap((collection) => {applyTransaction(() => {const newFileLinks = collection._embedded.elements;this.store.add(newFileLinks);@@ -136,8 +141,7 @@ export class FileLinksResourceService extends ResourceCollectionService<IFileLin),);});- },- this.toastAndThrow.bind(this),+ }),);}diff --git a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.tsindex f04a9746749..faae9fae93b 100644--- a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts+++ b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts@@ -38,8 +38,9 @@ import { take } from 'rxjs/operators';import { I18nService } from 'core-app/core/i18n/i18n.service';import { TimezoneService } from 'core-app/core/datetime/timezone.service';import { IFileLink } from 'core-app/core/state/file-links/file-link.model';-import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';+import { ToastService } from 'core-app/shared/components/toaster/toast.service';import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';+import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';import { SortFilesPipe } from 'core-app/shared/components/storages/pipes/sort-files.pipe';import { StorageFilesResourceService } from 'core-app/core/state/storage-files/storage-files.service';@@ -69,6 +70,9 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {alreadyLinkedFile: this.i18n.t('js.storages.file_links.already_linked_file'),alreadyLinkedDirectory: this.i18n.t('js.storages.file_links.already_linked_directory'),},+ toast: {+ successFileLinksCreated: (count:number):string => this.i18n.t('js.storages.file_links.success_create', { count }),+ },};public get selectedFileCount():number {@@ -86,6 +90,7 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {protected readonly sortFilesPipe:SortFilesPipe,protected readonly storageFilesResourceService:StorageFilesResourceService,private readonly i18n:I18nService,+ private readonly toastService:ToastService,private readonly timezoneService:TimezoneService,private readonly fileLinksResourceService:FileLinksResourceService,) {@@ -105,6 +110,9 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent {this.locals.addFileLinksHref as string,this.storageLink,files,+ ).subscribe(+ (fileLinks) => { this.toastService.addSuccess(this.text.toast.successFileLinksCreated(fileLinks.count)); },+ (error) => { this.toastService.addError(error); },);this.service.close();diff --git a/modules/storages/config/locales/js-en.yml b/modules/storages/config/locales/js-en.ymlindex e67396d352a..1a445ec595e 100644--- a/modules/storages/config/locales/js-en.yml+++ b/modules/storages/config/locales/js-en.yml@@ -42,6 +42,9 @@ en:zero: "Select files to link"one: "Link 1 file"other: "Link %{count} files"+ success_create:+ one: "Successfully created 1 file link."+ other: "Successfully created %{count} file links."not_allowed_tooltip: "Please log in to Nextcloud to access this file"already_linked_file: "This file is already linked to this work package."already_linked_directory: "This directory is already linked to this work package."