From b72adf92d5aefe22b2c7bda08c23196001918d5e Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Wed, 29 May 2024 18:56:47 +0300 Subject: [PATCH] cleanup --- .../description/description.service.ts | 9 - .../src/app/core/services/dmp/dmp.service.ts | 10 - .../file-transformer.service.ts | 10 +- .../core/services/matomo/analytics-service.ts | 144 ++++----- .../description-template-listing.component.ts | 194 +----------- .../dmp-blueprint-listing.component.ts | 186 +----------- .../maintenance-tasks.component.html | 10 - .../maintenance-tasks.component.ts | 30 -- .../app/ui/dashboard/dashboard.component.html | 137 ++++----- .../src/app/ui/dashboard/dashboard.module.ts | 7 - .../ui/dashboard/drafts/drafts.component.css | 222 -------------- .../ui/dashboard/drafts/drafts.component.html | 47 --- .../ui/dashboard/drafts/drafts.component.ts | 250 ---------------- .../recent-edited-activity.component.ts | 8 - ...edited-description-activity.component.html | 45 --- ...edited-description-activity.component.scss | 137 --------- ...t-edited-description-activity.component.ts | 196 ------------ .../recent-edited-dmp-activity.component.css | 200 ------------- .../recent-edited-dmp-activity.component.html | 117 -------- .../recent-edited-dmp-activity.component.ts | 224 -------------- .../editor/description-editor.component.scss | 18 -- .../description-listing-item.component.ts | 38 --- .../description-overview.component.ts | 138 ++++----- dmp-frontend/src/app/ui/dmp/dmp.module.ts | 53 ---- .../dataset-editor-details.component.html | 112 ------- .../dataset-editor-details.component.scss | 109 ------- .../dataset-editor-details.component.ts | 278 ------------------ .../dataset-editor-details.module.ts | 33 --- .../ui/dmp/overview/dmp-overview.component.ts | 97 ++---- .../src/app/ui/navbar/navbar.component.ts | 50 ++-- .../add-account-dialog.component.ts | 16 - .../ui/user-profile/user-profile.component.ts | 179 ++++------- .../src/assets/scss/core/mixins/_forms.scss | 30 -- dmp-frontend/src/common/forms/form-service.ts | 11 - 34 files changed, 307 insertions(+), 3038 deletions(-) delete mode 100644 dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css delete mode 100644 dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html delete mode 100644 dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts delete mode 100644 dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html delete mode 100644 dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.scss delete mode 100644 dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts delete mode 100644 dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css delete mode 100644 dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html delete mode 100644 dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts delete mode 100644 dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.html delete mode 100644 dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.scss delete mode 100644 dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts delete mode 100644 dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.module.ts diff --git a/dmp-frontend/src/app/core/services/description/description.service.ts b/dmp-frontend/src/app/core/services/description/description.service.ts index ef300bf0a..919391fdf 100644 --- a/dmp-frontend/src/app/core/services/description/description.service.ts +++ b/dmp-frontend/src/app/core/services/description/description.service.ts @@ -117,15 +117,6 @@ export class DescriptionService { return this.httpClient.get(url, { params: params, responseType: 'blob', observe: 'response', headers: headerXml }); } - // public downloadPDF(id: string): Observable> { - // return this.httpClient.get(`${this.apiBase}/${id}/export/Pdf`, { responseType: 'blob', observe: 'response', headers: this.headers }); - // } - - public download(id: string, format: string): Observable> { - //let headerDocx: HttpHeaders = this.headers.set('Content-Type', 'application/msword') - return this.httpClient.get(`${this.apiBase}/${id}/export/${format}`, { responseType: 'blob', observe: 'response', headers: this.headers }); - } - public updateDescriptionTemplate(item: UpdateDescriptionTemplatePersist): Observable { const url = `${this.apiBase}/update-description-template`; diff --git a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts index 5676eb8e4..a3bc640f3 100644 --- a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts +++ b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts @@ -168,16 +168,6 @@ export class DmpService { return this.http.get(url).pipe(catchError((error: any) => throwError(error))); } - public download(id: string, format: string): Observable> { - //let headerDoc: HttpHeaders = this.headers.set('Content-Type', 'application/msword') - return this.httpClient.get(`${this.apiBase}/${id}/export/${format}`, { responseType: 'blob', observe: 'response', headers: this.headers }); - } - - - // public downloadJson(id: string): Observable> { - // return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' }); - // } - downloadXML(id: Guid): Observable> { const url = `${this.apiBase}/xml/export/${id}`; let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml'); diff --git a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts index e698a8317..45981602d 100644 --- a/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts +++ b/dmp-frontend/src/app/core/services/file-transformer/file-transformer.service.ts @@ -37,7 +37,7 @@ export class FileTransformerService extends BaseService { private _availableFormats: RepositoryFileFormat[] = []; get availableFormats(): RepositoryFileFormat[] { - if (!this.authentication.currentAccountIsAuthenticated()){ + if (!this.authentication.currentAccountIsAuthenticated()) { return; } // console.log('availableFormats'); @@ -70,7 +70,7 @@ export class FileTransformerService extends BaseService { exportDmp(id: Guid, repositoryId: string, format: string) { this._loading = true; if (repositoryId == this.xmlExportRepo.repositoryId) { - this.dmpService.downloadXML(id) + this.dmpService.downloadXML(id) .pipe(takeUntil(this._destroyed)) .subscribe(response => { const blob = new Blob([response.body], { type: 'application/xml' }); @@ -84,10 +84,10 @@ export class FileTransformerService extends BaseService { })).subscribe(result => { if (result !== null) { const blob = new Blob([result.body], { type: 'application/octet-stream' }); - const filename = this.fileUtils.getFilenameFromContentDispositionHeader(result.headers.get('Content-Disposition')); + const filename = this.fileUtils.getFilenameFromContentDispositionHeader(result.headers.get('Content-Disposition')); - FileSaver.saveAs(blob, filename); - this.analyticsService.trackDownload('dmps', format, id.toString()); + FileSaver.saveAs(blob, filename); + this.analyticsService.trackDownload('dmps', format, id.toString()); } }); diff --git a/dmp-frontend/src/app/core/services/matomo/analytics-service.ts b/dmp-frontend/src/app/core/services/matomo/analytics-service.ts index 801298567..2db46ecb2 100644 --- a/dmp-frontend/src/app/core/services/matomo/analytics-service.ts +++ b/dmp-frontend/src/app/core/services/matomo/analytics-service.ts @@ -6,90 +6,90 @@ import { AnalyticsProviderType, AnalyticsProviders } from "@app/core/model/confi @Injectable() export class AnalyticsService { - //#region track page view - public static Dashboard: string = 'Home Dashboard'; - public static About: string = 'About'; - public static DescriptionTemplateEditor: string = 'Admin: DMP Blueprints'; - public static DescriptionTemplateListing: string = 'Admin: DMP Templates'; - public static DmpBlueprintEditor: string = 'Admin: DMP Blueprints'; - public static DmpBlueprintListing: string = 'Admin: DMP Templates'; - public static LanguagesEditor: string = 'Admin: Languages'; - public static PrefillingSourcesEditor: string = 'Admin: PrefillingSources'; - public static ReferencesEditor: string = 'Admin: References'; - public static TenantsEditor: string = 'Admin: Tenants'; - public static TenantConfigurationsColorsEditor: string = 'Admin: TenantConfigurations'; - public static TenantConfigurationsUserLocaleEditor: string = 'Admin: TenantConfigurations'; - public static DepositEditor: string = 'Admin: TenantConfigurations'; - public static FileTransformerEditor: string = 'Admin: TenantConfigurations'; - public static LogoEditor: string = 'Admin: TenantConfigurations'; - public static ContactContent: string = 'Contact Content'; - public static RecentEditedActivity: string = 'Recent DMP Activity'; - public static DescriptionEditor: string = 'Description Editor'; - public static DescriptionListing: string = 'Descriptions'; - public static DatasetCriteriaDialog: string = 'Dataset Criteria'; - public static DescriptionListingItem: string = 'Description Listing Item'; - public static DescriptionOverview: string = 'Description Overview'; - public static DmpEditor: string = 'DMP Editor'; - public static DmpListing: string = 'DMPs'; - public static DmpCriteriaDialog: string = 'DMP Criteria'; - public static DmpListingItem: string = 'DMP Listing Item'; - public static StartNewDmpDialog: string = 'Start New DMP Dialog'; - public static DmpUploadDialog: string = 'DMP Upload Dialog'; - public static DmpOverview: string = 'DMP Overview'; - public static FAQ: string = 'FAQ'; - public static Glossary: string = 'Glossary'; - public static Navbar: string = 'Navbar'; - public static Sidebar: string = 'Sidebar'; - public static SidebarFooter: string = 'Sidebar Footer'; - public static Terms: string = 'Terms of Service'; - public static UserGuideContent: string = 'User Guide Content'; - public static UserProfile: string = 'User Profile'; - public static NotificationTempplateEditor: string = 'Admin: Notification Tempplates'; - //#endregion + //#region track page view + public static Dashboard: string = 'Home Dashboard'; + public static About: string = 'About'; + public static DescriptionTemplateEditor: string = 'Admin: DMP Blueprints'; + public static DescriptionTemplateListing: string = 'Admin: DMP Templates'; + public static DmpBlueprintEditor: string = 'Admin: DMP Blueprints'; + public static DmpBlueprintListing: string = 'Admin: DMP Templates'; + public static LanguagesEditor: string = 'Admin: Languages'; + public static PrefillingSourcesEditor: string = 'Admin: PrefillingSources'; + public static ReferencesEditor: string = 'Admin: References'; + public static TenantsEditor: string = 'Admin: Tenants'; + public static TenantConfigurationsColorsEditor: string = 'Admin: TenantConfigurations'; + public static TenantConfigurationsUserLocaleEditor: string = 'Admin: TenantConfigurations'; + public static DepositEditor: string = 'Admin: TenantConfigurations'; + public static FileTransformerEditor: string = 'Admin: TenantConfigurations'; + public static LogoEditor: string = 'Admin: TenantConfigurations'; + public static ContactContent: string = 'Contact Content'; + public static RecentEditedActivity: string = 'Recent DMP Activity'; + public static DescriptionEditor: string = 'Description Editor'; + public static DescriptionListing: string = 'Descriptions'; + public static DatasetCriteriaDialog: string = 'Dataset Criteria'; + public static DescriptionListingItem: string = 'Description Listing Item'; + public static DescriptionOverview: string = 'Description Overview'; + public static DmpEditor: string = 'DMP Editor'; + public static DmpListing: string = 'DMPs'; + public static DmpCriteriaDialog: string = 'DMP Criteria'; + public static DmpListingItem: string = 'DMP Listing Item'; + public static StartNewDmpDialog: string = 'Start New DMP Dialog'; + public static DmpUploadDialog: string = 'DMP Upload Dialog'; + public static DmpOverview: string = 'DMP Overview'; + public static FAQ: string = 'FAQ'; + public static Glossary: string = 'Glossary'; + public static Navbar: string = 'Navbar'; + public static Sidebar: string = 'Sidebar'; + public static SidebarFooter: string = 'Sidebar Footer'; + public static Terms: string = 'Terms of Service'; + public static UserGuideContent: string = 'User Guide Content'; + public static UserProfile: string = 'User Profile'; + public static NotificationTempplateEditor: string = 'Admin: Notification Tempplates'; + //#endregion - //#region trackDownload - public static trackDmp: string = "dmps" - public static trackDatasets: string = "datasets" - public static trackDescriptions: string = "descriptions" - //#endregion + //#region trackDownload + public static trackDmp: string = "dmps" + public static trackDatasets: string = "datasets" + public static trackDescriptions: string = "descriptions" + //#endregion - constructor( + constructor( private configurationService: ConfigurationService, - private matomoService: MatomoService + private matomoService: MatomoService ) { } - trackPageView(customTitle?: string): void { - const analytics: AnalyticsProviders = this.configurationService.analyticsProviders; - for (let provider of analytics.providers) { - switch(provider.type) { - case(AnalyticsProviderType.Matomo): - this.matomoService.trackPageView(provider, customTitle); - break; - } - } + trackPageView(customTitle?: string): void { + const analytics: AnalyticsProviders = this.configurationService.analyticsProviders; + for (let provider of analytics.providers) { + switch (provider.type) { + case (AnalyticsProviderType.Matomo): + this.matomoService.trackPageView(provider, customTitle); + break; + } + } } trackSiteSearch(keyword: string, category?: string, resultsCount?: number): void { - const analytics: AnalyticsProviders = this.configurationService.analyticsProviders; + const analytics: AnalyticsProviders = this.configurationService.analyticsProviders; - for (let provider of analytics.providers) { - switch(provider.type) { - case(AnalyticsProviderType.Matomo): - this.matomoService.trackSiteSearch(keyword, category, resultsCount); - break; - } - } + for (let provider of analytics.providers) { + switch (provider.type) { + case (AnalyticsProviderType.Matomo): + this.matomoService.trackSiteSearch(keyword, category, resultsCount); + break; + } + } } trackDownload(category: "dmps" | "datasets" | "descriptions", type: string, id: string): void { - const analytics: AnalyticsProviders = this.configurationService.analyticsProviders; + const analytics: AnalyticsProviders = this.configurationService.analyticsProviders; - for (let provider of analytics.providers) { - switch(provider.type) { - case(AnalyticsProviderType.Matomo): - this.matomoService.trackDownload(category, type, id); - break; - } - } + for (let provider of analytics.providers) { + switch (provider.type) { + case (AnalyticsProviderType.Matomo): + this.matomoService.trackDownload(category, type, id); + break; + } + } } } \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts index 1b01dba47..374a6eb1e 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts @@ -2,9 +2,15 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; +import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; +import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; +import { SumarizeTextPipe } from '@app/core/pipes/sumarize-text.pipe'; +import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup'; import { AuthService } from '@app/core/services/auth/auth.service'; +import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; +import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { FileUtils } from '@app/core/services/utilities/file-utils.service'; @@ -12,6 +18,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se import { BaseListingComponent } from '@common/base/base-listing-component'; import { PipeService } from '@common/formatting/pipe.service'; import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; +import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { QueryResult } from '@common/model/query-result'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; @@ -23,13 +30,6 @@ import { Observable } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ImportDescriptionTemplateDialogComponent } from './import-description-template/import-description-template.dialog.component'; -import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; -import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; -import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup'; -import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; -import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status'; -import { SumarizeTextPipe } from '@app/core/pipes/sumarize-text.pipe'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @Component({ @@ -101,7 +101,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent { - // const blob = new Blob([response.body], { type: 'application/xml' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - // FileSaver.saveAs(blob, filename); - // }); - // } - - // deleteTemplate(id: string) { - // if (id) { - // this.dialog.open(ConfirmationDialogComponent, { - // data: { - // isDeleteConfirmation: true, - // confirmButton: this.languageService.instant('DESCRIPTION-TEMPLATE-EDITOR.CONFIRM-DELETE-DIALOG.CONFIRM-BUTTON'), - // cancelButton: this.languageService.instant("DESCRIPTION-TEMPLATE-EDITOR.CONFIRM-DELETE-DIALOG.CANCEL-BUTTON"), - // message: this.languageService.instant("DESCRIPTION-TEMPLATE-EDITOR.CONFIRM-DELETE-DIALOG.MESSAGE") - // } - // }) - // .afterClosed() - // .subscribe( - // confirmed => { - // if (confirmed) { - // this.descriptionTemplateService.delete(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe( - // complete => { - // this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DESCRIPTION-TEMPLATE-DELETE'), SnackBarNotificationLevel.Success); - // this.refresh(); - // }, - // error => { - // this.onCallbackError(error); - // if (error.error.statusCode == 674) { - // this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DESCRIPTION-TEMPLATE-DELETE'), SnackBarNotificationLevel.Error); - // } else { - // this.uiNotificationService.snackBarNotification(this.languageService.instant(error.message), SnackBarNotificationLevel.Error); - // } - // } - // ); - // } - // } - // ) - // } - // } - - // onCallbackError(errorResponse: HttpErrorResponse) { - // this.uiNotificationService.snackBarNotification(errorResponse.message, SnackBarNotificationLevel.Warning); - // } - - // getDefaultCriteria(): DescriptionTemplateCriteria { - // const defaultCriteria = new DescriptionTemplateCriteria(); - // return defaultCriteria; - // } - - // // makeItPublic(id: String) { - // // debugger; - // // this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe(); - // // } - - // parseStatus(value: number): string { - // const stringVal = value.toString() - // try { - // return this.statuses.find(status => status.value === stringVal).viewValue; - // } catch { - // return stringVal; - // } - // } - - // openDialog(): void { - // const dialogRef = this.dialog.open(DialodConfirmationUploadDescriptionTemplates, { - // restoreFocus: false, - // data: { - // message: this.languageService.instant('DESCRIPTION-TEMPLATE-LISTING.IMPORT.UPLOAD-XML-FILE-TITLE'), - // confirmButton: this.languageService.instant('DESCRIPTION-TEMPLATE-LISTING.IMPORT.UPLOAD-XML'), - // cancelButton: this.languageService.instant('DESCRIPTION-TEMPLATE-LISTING.IMPORT.UPLOAD-XML-FILE-CANCEL'), - // name: '', - // file: FileList, - // sucsess: false - // } - // }); - // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => { - // if (data && data.sucsess && data.name != null && data.file != null) { - // this.descriptionTemplateService.uploadFile(data.file, data.name) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(_ => { - // this.uiNotificationService.snackBarNotification(this.languageService.instant('DESCRIPTION-TEMPLATE-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); - // this.refresh(); - // }, - // error => { - // this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error); - // }); - // } - // }); - // } - // getStatusClass(status: number): string { - - // if (status === 1) {//finalized - // return 'status-chip-finalized' - // } - // if (status === 0) { - // return 'status-chip-draft'; - // } - // return ''; - // } - // } - - // export class DatasetDataSource extends DataSource { - - // totalCount = 0; - - // constructor( - // private _service: descriptionTemplateService, - // private _paginator: MatPaginator, - // private _sort: MatSort, - // private _criteria: DescriptionTemplateCriteriaComponent - // ) { - // super(); - - // } - - // connect(): Observable { - // const displayDataChanges = [ - // this._paginator.page - // //this._sort.matSortChange - // ]; - - // return observableMerge(...displayDataChanges).pipe( - // startWith(null), - // switchMap(() => { - // const startIndex = this._paginator.pageIndex * this._paginator.pageSize; - // let fields: Array = new Array(); - // if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; } - // const request = new DataTableRequest(startIndex, this._paginator.pageSize, { fields: fields }); - // request.criteria = this._criteria.criteria; - // return this._service.getPagedBlueprint(request); - // }), - // /*.catch((error: any) => { - // this._snackBar.openFromComponent(SnackBarNotificationComponent, { - // data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService }, - // duration: 3000, - // extraClasses: ['snackbar-warning'] - // }); - // //this._criteria.criteria.onCallbackError(error); - // return Observable.of(null); - // })*/ - // map(result => { - // return result; - // }), - // map(result => { - // if (!result) { return []; } - // if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } - // return result.data; - // })); - // } - - // disconnect() { - // // No-op - // } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts b/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts index ac2801abc..cf4d6b31c 100644 --- a/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/dmp-blueprint/listing/dmp-blueprint-listing.component.ts @@ -3,11 +3,13 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Router } from '@angular/router'; import { DmpBlueprintStatus } from '@app/core/common/enum/dmp-blueprint-status'; +import { DmpBlueprintVersionStatus } from '@app/core/common/enum/dmp-blueprint-version-status'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { DmpBlueprint } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { DmpBlueprintLookup } from '@app/core/query/dmp-blueprint.lookup'; import { AuthService } from '@app/core/services/auth/auth.service'; import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service'; +import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { FileUtils } from '@app/core/services/utilities/file-utils.service'; @@ -15,6 +17,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se import { BaseListingComponent } from '@common/base/base-listing-component'; import { PipeService } from '@common/formatting/pipe.service'; import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; +import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { QueryResult } from '@common/model/query-result'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service'; @@ -26,9 +29,6 @@ import { Observable } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component'; -import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; -import { DmpBlueprintVersionStatus } from '@app/core/common/enum/dmp-blueprint-version-status'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @Component({ @@ -98,7 +98,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent { -// const blob = new Blob([response.body], { type: 'application/xml' }); -// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); -// FileSaver.saveAs(blob, filename); -// }); -// } - -// deleteTemplate(id: string) { -// if (id) { -// this.dialog.open(ConfirmationDialogComponent, { -// data: { -// isDeleteConfirmation: true, -// confirmButton: this.languageService.instant('DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.CONFIRM-BUTTON'), -// cancelButton: this.languageService.instant("DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.CANCEL-BUTTON"), -// message: this.languageService.instant("DMP-BLUEPRINT-EDITOR.CONFIRM-DELETE-DIALOG.MESSAGE") -// } -// }) -// .afterClosed() -// .subscribe( -// confirmed => { -// if (confirmed) { -// this.dmpBlueprintService.delete(id) -// .pipe(takeUntil(this._destroyed)) -// .subscribe( -// complete => { -// this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DMP-BLUEPRINT-DELETE'), SnackBarNotificationLevel.Success); -// this.refresh(); -// }, -// error => { -// this.onCallbackError(error); -// if (error.error.statusCode == 674) { -// this.uiNotificationService.snackBarNotification(this.languageService.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DMP-BLUEPRINT-DELETE'), SnackBarNotificationLevel.Error); -// } else { -// this.uiNotificationService.snackBarNotification(this.languageService.instant(error.message), SnackBarNotificationLevel.Error); -// } -// } -// ); -// } -// } -// ) -// } -// } - -// onCallbackError(errorResponse: HttpErrorResponse) { -// this.uiNotificationService.snackBarNotification(errorResponse.message, SnackBarNotificationLevel.Warning); -// } - -// getDefaultCriteria(): DmpBlueprintCriteria { -// const defaultCriteria = new DmpBlueprintCriteria(); -// return defaultCriteria; -// } - -// // makeItPublic(id: String) { -// // debugger; -// // this.datasetService.makeDatasetPublic(id).pipe(takeUntil(this._destroyed)).subscribe(); -// // } - -// parseStatus(value: number): string { -// const stringVal = value.toString() -// try { -// return this.statuses.find(status => status.value === stringVal).viewValue; -// } catch { -// return stringVal; -// } -// } - -// openDialog(): void { -// const dialogRef = this.dialog.open(DialodConfirmationUploadDmpBlueprints, { -// restoreFocus: false, -// data: { -// message: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-TITLE'), -// confirmButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML'), -// cancelButton: this.languageService.instant('DMP-BLUEPRINT-LISTING.IMPORT.UPLOAD-XML-FILE-CANCEL'), -// name: '', -// file: FileList, -// sucsess: false -// } -// }); -// dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => { -// if (data && data.sucsess && data.name != null && data.file != null) { -// this.dmpBlueprintService.uploadFile(data.file, data.name) -// .pipe(takeUntil(this._destroyed)) -// .subscribe(_ => { -// this.uiNotificationService.snackBarNotification(this.languageService.instant('DMP-BLUEPRINT-LISTING.MESSAGES.TEMPLATE-UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success); -// this.refresh(); -// }, -// error => { -// this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error); -// }); -// } -// }); -// } -// getStatusClass(status: number): string { - -// if (status === 1) {//finalized -// return 'status-chip-finalized' -// } -// if (status === 0) { -// return 'status-chip-draft'; -// } -// return ''; -// } -// } - -// export class DatasetDataSource extends DataSource { - -// totalCount = 0; - -// constructor( -// private _service: dmpBlueprintService, -// private _paginator: MatPaginator, -// private _sort: MatSort, -// private _criteria: DmpBlueprintCriteriaComponent -// ) { -// super(); - -// } - -// connect(): Observable { -// const displayDataChanges = [ -// this._paginator.page -// //this._sort.matSortChange -// ]; - -// return observableMerge(...displayDataChanges).pipe( -// startWith(null), -// switchMap(() => { -// const startIndex = this._paginator.pageIndex * this._paginator.pageSize; -// let fields: Array = new Array(); -// if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; } -// const request = new DataTableRequest(startIndex, this._paginator.pageSize, { fields: fields }); -// request.criteria = this._criteria.criteria; -// return this._service.getPagedBlueprint(request); -// }), -// /*.catch((error: any) => { -// this._snackBar.openFromComponent(SnackBarNotificationComponent, { -// data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService }, -// duration: 3000, -// extraClasses: ['snackbar-warning'] -// }); -// //this._criteria.criteria.onCallbackError(error); -// return Observable.of(null); -// })*/ -// map(result => { -// return result; -// }), -// map(result => { -// if (!result) { return []; } -// if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } -// return result.data; -// })); -// } - -// disconnect() { -// // No-op -// } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html index de545dffd..2a30952d7 100644 --- a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html +++ b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.html @@ -1,13 +1,3 @@ -
diff --git a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts index aebb8d677..7edec9a02 100644 --- a/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts +++ b/dmp-frontend/src/app/ui/admin/maintenance-tasks/maintenance-tasks.component.ts @@ -29,35 +29,6 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit { ngOnInit(): void { } - //TODO: refactor - // migrateSemantics(ev: Event) { - // (ev.srcElement as HTMLButtonElement).disabled = true; - // this.maintenanceTasksService.migrateSemantics().pipe(takeUntil(this._destroyed)).subscribe( - // response => { - // (ev.srcElement as HTMLButtonElement).disabled = false; - // this.onCallbackSuccess(); - // }, - // error => { - // (ev.srcElement as HTMLButtonElement).disabled = false; - // this.onCallbackError(error); - // } - // ); - // } - - // addRdaInSemantics(ev: Event) { - // (ev.srcElement as HTMLButtonElement).disabled = true; - // this.maintenanceTasksService.addRdaInSemantics().pipe(takeUntil(this._destroyed)).subscribe( - // response => { - // (ev.srcElement as HTMLButtonElement).disabled = false; - // this.onCallbackSuccess(); - // }, - // error => { - // (ev.srcElement as HTMLButtonElement).disabled = false; - // this.onCallbackError(error); - // } - // ); - // } - generateIndex(ev: Event) { this.dialog.open(ConfirmationDialogComponent, { data: { @@ -252,5 +223,4 @@ export class MaintenanceTasksComponent extends BaseComponent implements OnInit { onCallbackError(error: any) { this.uiNotificationService.snackBarNotification(error, SnackBarNotificationLevel.Error); } - } diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index db416744e..c342e5fc4 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -5,77 +5,73 @@
-
- clear -
-

{{'NEW-RELEASE-NOTIFICATION.HINT' | translate}}

-
-

{{'NEW-RELEASE-NOTIFICATION.TITLE' | translate}}

-

{{'NEW-RELEASE-NOTIFICATION.BODY' | translate}}

- - +
+ clear +
+

{{'NEW-RELEASE-NOTIFICATION.HINT' | translate}}

-
- clear +

{{'NEW-RELEASE-NOTIFICATION.TITLE' | translate}}

+

{{'NEW-RELEASE-NOTIFICATION.BODY' | translate}}

-

{{'DASHBOARD.DMP-QUESTION' | translate}}

-

{{'DASHBOARD.INFO-DMP-TEXT' | translate}}

- -

- {{'DASHBOARD.NEW-QUESTION' | translate}} {{'DASHBOARD.OPEN-AIR-GUIDE' | translate}} {{'DASHBOARD.LEARN-MORE' | translate}} -

-

{{'DASHBOARD.DMP-ABOUT-BEG' | translate}} - {{'DASHBOARD.DATASET-DESCRIPTIONS-DASHBOARD-TEXT' | translate}} - {{'DASHBOARD.DMP-ABOUT-END' | translate}} -

- -
-
-
- -
-
-
-
- -
-
- - - + +
+
+ clear + +

{{'DASHBOARD.DMP-QUESTION' | translate}}

+

{{'DASHBOARD.INFO-DMP-TEXT' | translate}}

+ +

+ {{'DASHBOARD.NEW-QUESTION' | translate}} {{'DASHBOARD.OPEN-AIR-GUIDE' | translate}} {{'DASHBOARD.LEARN-MORE' | translate}} +

+

{{'DASHBOARD.DMP-ABOUT-BEG' | translate}} + {{'DASHBOARD.DATASET-DESCRIPTIONS-DASHBOARD-TEXT' | translate}} + {{'DASHBOARD.DMP-ABOUT-END' | translate}} +

+ +
+
+
+ +
+
+
+
+ +
+
+ + + +
+
{{'DASHBOARD.LATEST-ACTIVITY' | translate}}
-
{{'DASHBOARD.EMPTY-LIST' | translate}}
-
{{'DASHBOARD.EMPTY-LIST' | translate}}
> -
{{'DASHBOARD.EMPTY-LIST' | translate}}
-
{{'DASHBOARD.EMPTY-LIST' | translate}}
- {{dashboardStatistics?.dmpCount}}
- {{'DASHBOARD.DMPS' | translate}} + {{dashboardStatistics?.dmpCount}} +
+ {{'DASHBOARD.DMPS' | translate}}
- {{dashboardStatistics?.descriptionCount}}
- {{'DASHBOARD.DESCRIPTIONS' | translate}} + {{dashboardStatistics?.descriptionCount}} +
+ {{'DASHBOARD.DESCRIPTIONS' | translate}}
-
- {{grantCount}}
+
+ {{grantCount}} +
{{'DASHBOARD.GRANTS' | translate}}
- {{organizationCount}}
+ {{organizationCount}} +
{{'DASHBOARD.RELATED-ORGANISATIONS' | translate}}
@@ -169,23 +169,6 @@
-
@@ -212,10 +195,10 @@
-
{{'DASHBOARD.PUBLIC-USAGE' | translate}}
+
{{'DASHBOARD.PUBLIC-USAGE' | translate}}
-
{{dashboardStatistics?.dmpCount}}
+
{{dashboardStatistics?.dmpCount}}
{{'DASHBOARD.PUBLIC-DMPS' | translate}}
@@ -225,10 +208,10 @@
-
{{grantCount}}
+
{{grantCount}}
{{'DASHBOARD.GRANTS' | translate}}
- +
{{organizationCount}}
{{'DASHBOARD.RELATED-ORGANISATIONS' | translate}} diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts index f25b20282..1a1b02c3f 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.module.ts @@ -8,10 +8,7 @@ import { CommonUiModule } from '@common/ui/common-ui.module'; import { DescriptionListingModule } from '../description/listing/description-listing.module'; import { DmpListingModule } from '../dmp/listing/dmp-listing.module'; import { StartNewDmpDialogModule } from '../dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.module'; -import { DraftsComponent } from './drafts/drafts.component'; import { RecentEditedActivityComponent } from './recent-edited-activity/recent-edited-activity.component'; -import { RecentEditedDescriptionActivityComponent } from './recent-edited-description-activity/recent-edited-description-activity.component'; -import { RecentEditedDmpActivityComponent } from './recent-edited-dmp-activity/recent-edited-dmp-activity.component'; @NgModule({ imports: [ @@ -19,7 +16,6 @@ import { RecentEditedDmpActivityComponent } from './recent-edited-dmp-activity/r FormattingModule, DashboardRoutingModule, ConfirmationDialogModule, - // DatasetCopyDialogModule, FormsModule, ReactiveFormsModule, @@ -30,9 +26,6 @@ import { RecentEditedDmpActivityComponent } from './recent-edited-dmp-activity/r declarations: [ DashboardComponent, RecentEditedActivityComponent, - RecentEditedDmpActivityComponent, - RecentEditedDescriptionActivityComponent, - DraftsComponent ] }) export class DashboardModule { } diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css deleted file mode 100644 index e04ff07f7..000000000 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.css +++ /dev/null @@ -1,222 +0,0 @@ -.dmp-card, -.dataset-card { - min-width: 712px; - /* min-height: 308px; */ - background: #ffffff 0% 0% no-repeat padding-box; - box-shadow: 0px 3px 6px #0000001a; - border-radius: 4px; - opacity: 1; - margin-top: 2.43rem; - margin-bottom: 1rem; -} - -.remove-border-bottom ::ng-deep .mat-tab-header { - border-bottom: none; -} - -input[type="text"] { - background: #fafafa 0% 0% no-repeat padding-box; - border: 1px solid #d1d1d1; - border-radius: 4px; - opacity: 1; - width: 347px; - height: 56px; - font-family: Arial, FontAwesome; - padding-left: 15px; -} - -.edited-date { - text-align: left; - font-weight: 300; - line-height: 2.4; - letter-spacing: 0px; - color: #212121; - opacity: 0.6; -} - -.dmp-label { - background: var(--primary-color) 0% 0% no-repeat padding-box; - border-radius: 4px 0px; - opacity: 1; - min-width: 67px; - height: 37px; - color: #ffffff; - line-height: 2.4; -} - -.dataset-label { - width: auto; - height: 37px; - background: var(--secondary-color) 0% 0% no-repeat padding-box; - border-radius: 4px 0px; - text-align: left; - line-height: 2.8; - font-size: 0.875rem; - letter-spacing: 0px; - color: #212121; - font-weight: 400; -} - -.icon-align { - display: inline-flex; - vertical-align: middle; - /* line-height: .9em; */ - /* padding-bottom: 0.4rem; */ -} - -.dataset-card-actions, -.dmp-card-actions { - display: flex; - flex-direction: row; - border-top: 1px solid #dbdbdb; - line-height: 4; - color: #848484; -} - -.dataset-card-actions a, -.dmp-card-actions a { - color: #848484 !important; - text-decoration: none !important; -} - -.dataset-card-actions a:hover, -.dmp-card-actions a:hover { - color: var(--primary-color) !important; -} - -.dmp-dataset-descriptions-title { - color: #000000; - opacity: 0.6; - padding-top: 1.5rem; - padding-bottom: 0.8rem; -} - -.dmp-dataset-descriptions-name { - color: #000000; - opacity: 0.6; - font-weight: 700; -} - -.show-more { - color: black !important; -} - -.show-more:hover { - color: var(--primary-color) !important; -} - -.btn-load-more { - border: 2px solid #212121; - border-radius: 30px; - opacity: 1; - min-width: 132px; - width: auto; - height: 40px; - margin-top: 4.125rem; -} - -.btn-load-more:hover { - background-color: black; - color: white; -} - -.draft { - color: #f16868; -} - -.pointer { - cursor: pointer; -} - -.search-form { - text-align: left; - width: 20rem; -} - -.search-form mat-icon { - color: var(--primary-color); -} - -::ng-deep .search-form .mat-form-field-wrapper { - background-color: white !important; - padding-bottom: 0 !important; -} - -::ng-deep .sort-form .mat-form-field-wrapper { - background-color: white !important; - padding-bottom: 0 !important; -} - -::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix { - padding: 0.3rem 0rem 0.6rem 0rem !important; -} - -/* .grey { - color: rgb(162, 162, 162); -} - -.card-draft { - height: calc(100% - 60px); -} - -.draft-desc { - position: relative; - overflow: hidden; - height: 60px; - font-size: 14px; - padding-top: 15px; - margin-bottom: 30px; -} - -.draft-desc:after { - content: ""; - text-align: right; - position: absolute; - bottom: 0; - right: 0; - width: 70%; - height: 1.4em; - background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 50%); -} - -td:hover .draft-desc:after { - background: rgba(255, 255, 255, 0); -} - -.draft-subtitle { - font-weight: 400; - color: rgb(162, 162, 162); -} - -.draft-title { - font-weight: 500; - color: black; -} - -.drafts-more-btn { - text-align: right; -} - -.grant-pill { - width: 80%; - border: 1px solid rgb(231, 230, 230); - color: rgb(145, 145, 145); - background-color: rgb(242, 242, 242); - border-radius: 10em; - text-align: center; - max-width: 160px; - padding-left: 0.5em; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.view-all { - margin-left: auto; - margin-bottom: 0px !important; - color: #6aa4d9; -} - -.view-all:hover { - color: rgb(46, 117, 182) !important; -} */ diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html deleted file mode 100644 index ec841d1d7..000000000 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html +++ /dev/null @@ -1,47 +0,0 @@ -
-
- -
- {{'DMP-LISTING.EMPTY-LIST' | translate}} -
-
-
- -
- {{'DMP-LISTING.SORT-BY' | translate}}: -
-
- - - {{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}} - {{enumUtils.toRecentActivityOrderString(order.Label)}} - - -
- - -
- - search - - {{formGroup.get('like').getError('backendError').message}} - -
- -
-
- -
-
- - -
-
- {{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}} -
-
- -
-
-
-
diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts deleted file mode 100644 index dc99793e1..000000000 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { Location } from '@angular/common'; -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormBuilder, UntypedFormControl } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; -import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item'; -import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; -import { Description } from '@app/core/model/description/description'; -import { Dmp, DmpDescriptionTemplate, DmpUser } from "@app/core/model/dmp/dmp"; -import { DmpReference } from '@app/core/model/dmp/dmp-reference'; -import { Reference } from '@app/core/model/reference/reference'; -import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup'; -import { DashboardService } from "@app/core/services/dashboard/dashboard.service"; -import { DmpService } from '@app/core/services/dmp/dmp.service'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { BaseComponent } from '@common/base/base.component'; -import { debounceTime, takeUntil } from 'rxjs/operators'; -import { nameof } from 'ts-simple-nameof'; -import { AuthService } from '../../../core/services/auth/auth.service'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { DmpStatus } from '@app/core/common/enum/dmp-status'; -import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; - -@Component({ - selector: 'app-drafts', - templateUrl: './drafts.component.html', - styleUrls: ['./drafts.component.css'] -}) -export class DraftsComponent extends BaseComponent implements OnInit { - - lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); - pageSize: number = 5; - pageLessSize = this.pageSize; - listingItems: RecentActivityItem[] = []; - - public formGroup = new UntypedFormBuilder().group({ - like: new UntypedFormControl(), - order: new UntypedFormControl() - }); - publicMode = false; - - order = RecentActivityOrder; - - totalCount: number; - startIndex: number = 0; - offsetLess: number = 0; - page: number = 1; - @Input() isActive: boolean = false; - - constructor( - private route: ActivatedRoute, - private router: Router, - public enumUtils: EnumUtils, - private authentication: AuthService, - private dashboardService: DashboardService, - private location: Location, - private dmpService: DmpService, - private analyticsService: AnalyticsService - ) { - super(); - } - - ngOnInit() { - this.analyticsService.trackPageView(AnalyticsService.RecentEditedActivity); - this.route.queryParams.subscribe(params => { - if (this.isActive) { - let page = (params['page'] === undefined) ? 1 : +params['page']; - this.page = (page <= 0) ? 1 : page; - - this.startIndex = (this.page - 1) * this.pageSize; - if (this.page > 1) { - this.offsetLess = (this.page - 2) * this.pageSize; - } - - let order = params['order']; - if (this.isAuthenticated()) { - if (order === undefined || (order != this.order.UpdatedAt && order != this.order.Label && order != this.order.Status)) { - order = this.order.UpdatedAt; - } - } else { - //TODO refactor - // if (order === undefined || (order != this.order.PUBLISHED && order != this.order.LABEL)) { - // order = this.order.PUBLISHED; - // } - } - this.formGroup.get('order').setValue(order); - - let keyword = (params['keyword'] === undefined || params['keyword'].length <= 0) ? "" : params['keyword']; - this.formGroup.get("like").setValue(keyword); - - this.updateUrl(); - } - }); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); - - this.refresh(); - } - - ngOnChanges() { - if (this.isActive) { - this.updateUrl(); - } - } - - updateUrl() { - let parameters = "?type=drafts" + - (this.page != 1 ? "&page=" + this.page : "") + - //TODO refactor - //(((this.formGroup.get("order").value != this.order.MODIFIED && !this.publicMode) || (this.formGroup.get("order").value != this.order.PUBLISHED && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") + - (this.formGroup.get("like").value ? ("&keyword=" + this.formGroup.get("like").value) : ""); - this.location.go(this.router.url.split('?')[0] + parameters); - } - - public isAuthenticated(): boolean { - return this.authentication.currentAccountIsAuthenticated(); - } - - refresh(): void { - this.lookup.onlyDraft = true; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; - this.lookup.like = this.formGroup.get('like').value; - this.lookup.project = { - - fields: [ - [nameof(x => x.dmp), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.description)].join('.'), - [nameof(x => x.dmp), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), - [nameof(x => x.dmp), nameof(x => x.version)].join('.'), - [nameof(x => x.dmp), nameof(x => x.versionStatus)].join('.'), - [nameof(x => x.dmp), nameof(x => x.groupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.updatedAt)].join('.'), - [nameof(x => x.dmp), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.hash)].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - - [nameof(x => x.description), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.status)].join('.'), - [nameof(x => x.description), nameof(x => x.updatedAt)].join('.'), - [nameof(x => x.description), nameof(x => x.isActive)].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - ] - }; - - this.getItems(); - } - - loadMore() { - this.pageSize = this.pageSize + this.pageLessSize; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.getItems(); - } - - loadLess() { - this.pageSize = this.pageSize - this.pageLessSize; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.getItems(); - } - - private getItems() { - this.listingItems = []; - - this.dashboardService - .getMyRecentActivityItems(this.lookup) - .pipe(takeUntil(this._destroyed)) - .subscribe(response => { - response.forEach(item => { - if (item.dmp) { - if (item.dmp.descriptions) { - if (item.dmp.status == DmpStatus.Finalized) { - item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); - } else { - item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); - } - } - item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); - this.listingItems.push(item); - } - if (item.description) { - if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item); - } - }) - }); - } -} diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index df0f2d592..cd50579d5 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -130,14 +130,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn } updateUrl() { - // let parameters = "" + - // (this.page != 1 ? "&page=" + this.page : "") + - // //TODO refactor - // // (((this.formGroup.get("order").value != this.order.UpdatedAt && !this.publicMode) || (this.formGroup.get("order").value != this.order.Published && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") + - // (this.formGroup.get("like").value ? ("&keyword=" + this.formGroup.get("like").value) : ""); - // this.location.go(this.router.url.split('?')[0] + parameters); - - let parametersArray: string[] = [ ...(this.type ? ["type=" + this.type] : []), ...(this.currentPage > 1 ? ["page=" + this.currentPage] : []), diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html deleted file mode 100644 index 4de578a83..000000000 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html +++ /dev/null @@ -1,45 +0,0 @@ -
-
-
-
- -
- {{'DMP-LISTING.SORT-BY' | translate}}: -
-
- - - {{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}} - - {{enumUtils.toRecentActivityOrderString(order.Label)}} - {{enumUtils.toRecentActivityOrderString(order.Status)}} - - - -
- - -
- - search - - {{formGroup.get('like').getError('backendError').message}} - -
- -
-
- -
-
- -
-
- {{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}} -
-
- -
-
-
-
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.scss b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.scss deleted file mode 100644 index 9fb8a1fa2..000000000 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.scss +++ /dev/null @@ -1,137 +0,0 @@ -.remove-border-bottom ::ng-deep .mat-tab-header { - border-bottom: none; -} - -input[type="text"] { - background: #fafafa 0% 0% no-repeat padding-box; - border: 1px solid #d1d1d1; - border-radius: 4px; - opacity: 1; - width: 347px; - height: 56px; - font-family: Arial, FontAwesome; - padding-left: 15px; -} - -.dmp-label { - background: var(--primary-color) 0% 0% no-repeat padding-box; - border-radius: 4px 0px; - opacity: 1; - min-width: 67px; - height: 37px; - color: #ffffff; - line-height: 2.4; -} - -.description-label { - width: auto; - height: 37px; - background: var(--secondary-color) 0% 0% no-repeat padding-box; - border-radius: 4px 0px; - text-align: left; - line-height: 2.8; - font-size: 0.875rem; - letter-spacing: 0px; - color: #212121; - font-weight: 400; -} - -.icon-align { - display: inline-flex; - vertical-align: middle; - // line-height: .9em; - // padding-bottom: 0.4rem; -} - -.dmp-subtitle, -.description-subtitle { - - .icon-align { - display: inline-flex; - vertical-align: top; - margin-right: .2rem; - line-height: .95em; - } -} - -.description-card-actions, -.dmp-card-actions { - display: flex; - flex-direction: row; - border-top: 1px solid #dbdbdb; - line-height: 4; - color: #848484; -} - -.description-card-actions a, -.dmp-card-actions a { - color: #848484 !important; - text-decoration: none !important; -} - -.description-card-actions a:hover, -.dmp-card-actions a:hover { - color: var(--primary-color) !important; -} - -.dmp-description-descriptions-title { - color: #000000; - opacity: 0.6; - padding-top: 1.5rem; - padding-bottom: 0.8rem; -} - -.dmp-description-descriptions-name { - color: #000000; - opacity: 0.6; - font-weight: 700; -} - -.show-more { - color: black !important; -} - -.show-more:hover { - color: var(--primary-color) !important; -} - -.btn-load-more { - border: 2px solid #212121; - border-radius: 30px; - opacity: 1; - min-width: 132px; - width: auto; - height: 40px; - margin-top: 4.125rem; -} - -.btn-load-more:hover { - background-color: black; - color: white; -} - -.draft { - color: #f16868; -} - -.pointer { - cursor: pointer; -} - -.search-form { - text-align: left; - width: 20rem; -} - -.search-form mat-icon { - color: var(--primary-color); -} - -::ng-deep .search-form .mat-form-field-wrapper { - background-color: white !important; - padding-bottom: 0 !important; -} - -::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix { - padding: 0.3rem 0rem 0.6rem 0rem !important; -} diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts deleted file mode 100644 index 1d6860471..000000000 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { Location } from '@angular/common'; -import { Component, Input, OnInit } from '@angular/core'; -import { UntypedFormBuilder, UntypedFormControl } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; -import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; -import { Description } from '@app/core/model/description/description'; -import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item'; -import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; -import { DmpReference } from '@app/core/model/dmp/dmp-reference'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { Reference } from '@app/core/model/reference/reference'; -import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup'; -import { AuthService } from '@app/core/services/auth/auth.service'; -import { DashboardService } from '@app/core/services/dashboard/dashboard.service'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { BaseComponent } from '@common/base/base.component'; -import { debounceTime, takeUntil } from 'rxjs/operators'; -import { nameof } from 'ts-simple-nameof'; -import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; - -@Component({ - selector: 'app-recent-edited-description-activity', - templateUrl: './recent-edited-description-activity.component.html', - styleUrls: ['./recent-edited-description-activity.component.scss'] -}) -export class RecentEditedDescriptionActivityComponent extends BaseComponent implements OnInit { - - lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); - pageSize: number = 5; - pageLessSize= this.pageSize; - listingItems: Description[] = []; - - - public formGroup = new UntypedFormBuilder().group({ - like: new UntypedFormControl(), - order: new UntypedFormControl() - }); - publicMode = false; - - order = RecentActivityOrder; - - totalCount: number; - startIndex: number = 0; - offsetLess: number = 0; - page: number = 1; - @Input() isActive: boolean = false; - - constructor( - private route: ActivatedRoute, - private router: Router, - public enumUtils: EnumUtils, - private authentication: AuthService, - private dashboardService: DashboardService, - private location: Location, - private analyticsService: AnalyticsService - ) { - super(); - } - - ngOnInit() { - this.analyticsService.trackPageView(AnalyticsService.RecentEditedActivity); - this.route.queryParams.subscribe(params => { - if (this.isActive) { - let page = (params['page'] === undefined) ? 1 : +params['page']; - this.page = (page <= 0) ? 1 : page; - - this.startIndex = (this.page - 1) * this.pageSize; - if (this.page > 1) { - this.offsetLess = (this.page - 2) * this.pageSize; - } - - let order = params['order']; - if (this.isAuthenticated()) { - if (order === undefined || (order != this.order.UpdatedAt && order != this.order.Label && order != this.order.Status)) { - order = this.order.UpdatedAt; - } - } else { - //TODO refactor - // if (order === undefined || (order != this.order.PUBLISHED && order != this.order.LABEL)) { - // order = this.order.PUBLISHED; - // } - } - this.formGroup.get('order').setValue(order); - - let keyword = (params['keyword'] === undefined || params['keyword'].length <= 0) ? "" : params['keyword']; - this.formGroup.get("like").setValue(keyword); - - this.updateUrl(); - } - }); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => { - console.log('valueChanges'); - this.refresh() - }); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); - - this.refresh(); - } - - ngOnChanges() { - if (this.isActive) { - this.updateUrl(); - } - } - - updateUrl() { - let parameters = "?type=descriptions" + - (this.page != 1 ? "&page=" + this.page : "") + - //TODO refactor - //(((this.formGroup.get("order").value != this.order.MODIFIED && !this.publicMode) || (this.formGroup.get("order").value != this.order.PUBLISHED && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") + - (this.formGroup.get("like").value ? ("&keyword=" + this.formGroup.get("like").value) : ""); - this.location.go(this.router.url.split('?')[0] + parameters); - } - - public isAuthenticated(): boolean { - return this.authentication.currentAccountIsAuthenticated(); - } - - refresh(): void { - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.lookup.onlyDescription = true; - this.lookup.orderField = this.formGroup.get('order').value ??this.order.UpdatedAt; - this.lookup.like = this.formGroup.get('like').value; - this.lookup.project = { - - fields: [ - [nameof(x => x.description), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.status)].join('.'), - [nameof(x => x.description), nameof(x => x.updatedAt)].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.EditDescription].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.DeleteDescription].join('.'), - [nameof(x => x.description), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.reference)].join('.'), - [nameof(x => x.description), nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - ] - }; - - this.getItems(); - } - - loadMore() { - this.pageSize = this.pageSize + this.pageLessSize; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.getItems(); - } - - loadLess() { - this.pageSize = this.pageSize - this.pageLessSize; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.getItems(); - } - - getItems(){ - this.listingItems = []; - - this.dashboardService - .getMyRecentActivityItems(this.lookup) - .pipe(takeUntil(this._destroyed)) - .subscribe(response => { - response.forEach(item => { - if (item.description){ - if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item.description); - } - }) - }); - } -} diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css deleted file mode 100644 index c28a3cc62..000000000 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.css +++ /dev/null @@ -1,200 +0,0 @@ -.dmp-card, .dataset-card { - min-width: 712px; - /* min-height: 308px; */ - background: #ffffff 0% 0% no-repeat padding-box; - box-shadow: 0px 3px 6px #0000001a; - border-radius: 4px; - opacity: 1; - margin-top: 2.43rem; - margin-bottom: 1rem; -} - -.remove-border-bottom ::ng-deep .mat-tab-header { - border-bottom: none; -} - -input[type="text"] { - background: #fafafa 0% 0% no-repeat padding-box; - border: 1px solid #d1d1d1; - border-radius: 4px; - opacity: 1; - width: 347px; - height: 56px; - font-family: Arial, FontAwesome; - padding-left: 15px; -} - -.dmp-label { - background: var(--primary-color) 0% 0% no-repeat padding-box; - border-radius: 4px 0px; - opacity: 1; - min-width: 67px; - height: 37px; - color: #ffffff; - line-height: 2.4; -} - -.dataset-label { - width: auto; - height: 37px; - background: var(--secondary-color) 0% 0% no-repeat padding-box; - border-radius: 4px 0px; - text-align: left; - line-height: 2.8; - font-size: 0.875rem; - letter-spacing: 0px; - color: #212121; -} - -.icon-align { - display: inline-flex; - vertical-align: middle; - /* line-height: .9em; */ - /* padding-bottom: 0.4rem; */ -} - -.dataset-card-actions, .dmp-card-actions { - display: flex; - flex-direction: row; - border-top: 1px solid #dbdbdb; - line-height: 4; - color: #848484; -} - -.dataset-card-actions a, .dmp-card-actions a { - color: #848484 !important; - text-decoration: none !important; -} - -.dataset-card-actions a:hover, .dmp-card-actions a:hover { - color: var(--primary-color) !important; -} - -.dmp-dataset-descriptions-title { - color: #000000; - opacity: 0.6; - padding-top: 1.5rem; - padding-bottom: 0.8rem; -} - -.dmp-dataset-descriptions-name { - color: #000000; - opacity: 0.6; - font-weight: 700; -} - -.show-more { - color: black !important; -} - -.show-more:hover { - color: var(--primary-color) !important; -} - -.btn-load-more { - border: 2px solid #212121; - border-radius: 30px; - opacity: 1; - min-width: 132px; - width: auto; - height: 40px; - margin-top: 4.125rem; -} - -.btn-load-more:hover { - background-color: black; - color: white; -} - -.draft { - color: #f16868; -} - -.pointer { - cursor: pointer; -} - -.search-form { - text-align: left; - width: 20rem; -} - -.search-form mat-icon { - color: var(--primary-color); -} - -::ng-deep .search-form .mat-form-field-wrapper { - background-color: white !important; - padding-bottom: 0 !important; -} - -::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix { - padding: 0.3rem 0rem 0.6rem 0rem !important; -} - -/* th { - text-transform: uppercase; -} - -a { - color: #212529; -} - -.table-row { - cursor: pointer; - display: table-row; -} - -.is-public { - padding-left: 5px; - padding-right: 5px; - border: 1px solid var(--primary-color-3)3b; - color: var(--primary-color-3); - background-color: var(--primary-color-3)0f; - border-radius: 10em; - text-align: center; -} - -.template-name { - padding-left: 0.5em; - border: 1px solid rgb(218, 227, 243); - color: rgb(43, 104, 209); - background-color: rgb(236, 241, 249); - border-radius: 10em; - text-align: center; - max-width: 160px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.chip { - padding: 0.1em 1em; - margin-bottom: 1em; - margin-left: 2.5em; - margin-right: 2.5em; - border-radius: 10em; - background-color: #0d7489; - color: #fff; - text-transform: uppercase; - text-align: center; - font-weight: 500; - max-width: 160px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.mat-icon-button :hover { - color: rgb(120, 173, 220); -} - -.view-all { - margin-left: auto; - margin-bottom: 0px !important; - color: #6aa4d9; -} - -.view-all:hover { - color: rgb(46, 117, 182) !important; -} */ diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html deleted file mode 100644 index 4ee06c75f..000000000 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html +++ /dev/null @@ -1,117 +0,0 @@ -
-
-
-
- -
- {{'DMP-LISTING.SORT-BY' | translate}}: -
-
- - - {{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}} - - {{enumUtils.toRecentActivityOrderString(order.Label)}} - {{enumUtils.toRecentActivityOrderString(order.Status)}} - - - -
- - -
- - search - - {{formGroup.get('like').getError('backendError').message}} - -
- -
-
- -
-
- -
- -
- {{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}} -
-
- -
-
-
-
diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts deleted file mode 100644 index 42d16bc9d..000000000 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { Location } from '@angular/common'; -import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; -import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { DescriptionStatus } from '@app/core/common/enum/description-status'; -import { DmpStatus } from '@app/core/common/enum/dmp-status'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; -import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item'; -import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; -import { Description } from '@app/core/model/description/description'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; -import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp'; -import { DmpReference } from '@app/core/model/dmp/dmp-reference'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { Reference } from '@app/core/model/reference/reference'; -import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup'; -import { AuthService } from '@app/core/services/auth/auth.service'; -import { DashboardService } from '@app/core/services/dashboard/dashboard.service'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; -import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { BaseComponent } from '@common/base/base.component'; -import { debounceTime, takeUntil } from 'rxjs/operators'; -import { nameof } from 'ts-simple-nameof'; - -@Component({ - selector: 'app-recent-edited-dmp-activity', - templateUrl: './recent-edited-dmp-activity.component.html', - styleUrls: ['./recent-edited-dmp-activity.component.css'] -}) -export class RecentEditedDmpActivityComponent extends BaseComponent implements OnInit { - - lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); - pageSize: number = 5; - pageLessSize = this.pageSize; - - @Output() totalCountDmps: EventEmitter = new EventEmitter(); - - @ViewChild("dmps") resultsContainer; - - listingItems: Dmp[] = []; - isDraft: boolean; - - totalCount: number; - startIndex: number = 0; - offsetLess: number = 0; - dmpFormGroup: UntypedFormGroup; - public formGroup = new UntypedFormBuilder().group({ - like: new UntypedFormControl(), - order: new UntypedFormControl() - }); - publicMode = false; - - order = RecentActivityOrder; - - page: number = 1; - @Input() isActive: boolean = false; - - constructor( - private route: ActivatedRoute, - private router: Router, - public enumUtils: EnumUtils, - private authentication: AuthService, - private dashboardService: DashboardService, - private location: Location, - private analyticsService: AnalyticsService - ) { - super(); - } - - ngOnInit() { - this.analyticsService.trackPageView(AnalyticsService.RecentEditedActivity); - this.route.queryParams.subscribe(params => { - if (this.isActive) { - let page = (params['page'] === undefined) ? 1 : +params['page']; - this.page = (page <= 0) ? 1 : page; - - this.startIndex = (this.page - 1) * this.pageSize; - if (this.page > 1) { - this.offsetLess = (this.page - 2) * this.pageSize; - } - - let order = params['order']; - if (this.isAuthenticated()) { - //TODO refactor - // if (order === undefined || (order != this.order.MODIFIED && order != this.order.LABEL && order != this.order.STATUS)) { - // order = this.order.MODIFIED; - // } - } else { - //TODO refactor - // if (order === undefined || (order != this.order.PUBLISHED && order != this.order.LABEL)) { - // order = this.order.PUBLISHED; - // } - } - this.formGroup.get('order').setValue(order); - - let keyword = (params['keyword'] === undefined || params['keyword'].length <= 0) ? "" : params['keyword']; - this.formGroup.get("like").setValue(keyword); - - this.updateUrl(); - } - }); - - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); - - this.refresh(); - } - - ngOnChanges() { - if (this.isActive) { - this.updateUrl(); - } - } - - updateUrl() { - let parameters = "?type=dmps" + - (this.page != 1 ? "&page=" + this.page : "") + - //TODO refactor - //(((this.formGroup.get("order").value != this.order.MODIFIED && !this.publicMode) || (this.formGroup.get("order").value != this.order.PUBLISHED && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") + - (this.formGroup.get("like").value ? ("&keyword=" + this.formGroup.get("like").value) : ""); - this.location.go(this.router.url.split('?')[0] + parameters); - } - - public isAuthenticated(): boolean { - return this.authentication.currentAccountIsAuthenticated(); - } - - refresh(): void { - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.lookup.onlyDmp = true; - this.lookup.orderField = this.formGroup.get('order').value ?? this.order.UpdatedAt; - this.lookup.like = this.formGroup.get('like').value; - this.lookup.project = { - fields: [ - [nameof(x => x.dmp), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.description)].join('.'), - [nameof(x => x.dmp), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.versionStatus)].join('.'), - [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), - [nameof(x => x.dmp), nameof(x => x.version)].join('.'), - [nameof(x => x.dmp), nameof(x => x.groupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.updatedAt)].join('.'), - [nameof(x => x.dmp), nameof(x => x.hash)].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.EditDmp].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.label)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.reference), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpReferences), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.sectionId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), - [nameof(x => x.dmp), nameof(x => x.dmpDescriptionTemplates), nameof(x => x.isActive)].join('.'), - [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), - ] - }; - - this.getItems(); - } - - loadMore() { - this.pageSize = this.pageSize + this.pageLessSize; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.getItems(); - } - - loadLess() { - this.pageSize = this.pageSize - this.pageLessSize; - this.lookup.page = { size: this.pageSize, offset: 0 }; - this.getItems(); - } - - private getItems() { - this.listingItems = []; - - this.dashboardService - .getMyRecentActivityItems(this.lookup) - .pipe(takeUntil(this._destroyed)) - .subscribe(response => { - response.forEach(item => { - if (item.dmp) { - item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); - if (item.dmp.descriptions) { - if (item.dmp.status == DmpStatus.Finalized) { - item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); - } else { - item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); - } - } - this.listingItems.push(item.dmp); - } - - }) - - }); - } -} diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss b/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss index 4503a14f3..e489b04e5 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.scss @@ -63,24 +63,6 @@ padding-right: 6px; } - .downloadPDF { - margin-top: 15px; - margin-bottom: 15px; - margin-right: 15px; - } - - .downloadXML { - margin-top: 15px; - margin-bottom: 15px; - margin-right: 15px; - } - - .downloadDOCX { - margin-top: 15px; - margin-bottom: 15px; - margin-right: 15px; - } - .updateDescriptionProfile { margin-top: 15px; margin-bottom: 15px; diff --git a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts index 41e0d5890..eef4fa62f 100644 --- a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts @@ -124,44 +124,6 @@ export class DescriptionListingItemComponent extends BaseComponent implements On return this.isPublic ? [`/explore-plans/overview/public/${this.description.dmp.id}`] : [`/plans/edit/${this.description.dmp.id}`]; } - // downloadPDF(description: Description): void { - // this.descriptionService.downloadPDF(description.id.toString()) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(response => { - // const blob = new Blob([response.body], { type: 'application/pdf' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - // FileSaver.saveAs(blob, filename); - // this.matomoService.trackDownload('descriptions', "pdf", description.id.toString()); - // }); - // } - - download(description: Description, format: string): void { - this.descriptionService.download(description.id.toString(), format) - .pipe(takeUntil(this._destroyed)) - .subscribe(response => { - const blob = new Blob([response.body], { type: 'application/octet-stream' }); - const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - FileSaver.saveAs(blob, filename); - this.analyticsService.trackDownload('descriptions', format, description.id.toString()); - }); - - } - - downloadXML(description: Description): void { - //TODO: add file transformer service - // this.descriptionService.downloadXML(description.id as string) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(response => { - // const blob = new Blob([response.body], { type: 'application/xml' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - // FileSaver.saveAs(blob, filename); - // this.matomoService.trackDownload('descriptions', "xml", description.id); - // }); - } - openShareDialog() { // TODO: This is a shared component. Put it in a seperate module. const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts index b9fa72e91..50516f2f6 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts @@ -2,45 +2,44 @@ import { Component, OnInit } from '@angular/core'; import { BaseComponent } from '@common/base/base.component'; // import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item'; import { Location } from '@angular/common'; -import { UntypedFormBuilder, UntypedFormControl, Validators } from '@angular/forms'; +import { UntypedFormBuilder, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; import { DmpAccessType } from '@app/core/common/enum/dmp-access-type'; import { DmpStatus } from '@app/core/common/enum/dmp-status'; import { DmpUserRole } from '@app/core/common/enum/dmp-user-role'; +import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description, DescriptionStatusPersist } from '@app/core/model/description/description'; +import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { Dmp, DmpDescriptionTemplate, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp'; import { DmpReference } from '@app/core/model/dmp/dmp-reference'; +import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; import { AuthService } from '@app/core/services/auth/auth.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { DescriptionService } from '@app/core/services/description/description.service'; import { DmpService } from '@app/core/services/dmp/dmp.service'; import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service'; +import { LockService } from '@app/core/services/lock/lock.service'; +import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; import { ReferenceService } from '@app/core/services/reference/reference.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { FileUtils } from '@app/core/services/utilities/file-utils.service'; +import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; +import { DescriptionValidationOutput } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component'; +import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; -import * as FileSaver from 'file-saver'; -import { filter, takeUntil } from 'rxjs/operators'; +import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { DescriptionCopyDialogComponent } from '../description-copy-dialog/description-copy-dialog.component'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { DescriptionValidationOutput } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component'; -import { LockService } from '@app/core/services/lock/lock.service'; -import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component'; -import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; -import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @Component({ @@ -122,19 +121,19 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni // this.users = this.description.dmp.users; this.checkLockStatus(this.description.id); this.canDelete = (this.authService.hasPermission(AppPermission.DeleteDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false; + this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false; this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; + this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; this.canReview = (this.authService.hasPermission(AppPermission.ReviewDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.ReviewDescription)) && this.description.belongsToCurrentTenant != false; + this.description.authorizationFlags?.some(x => x === AppPermission.ReviewDescription)) && this.description.belongsToCurrentTenant != false; this.canFinalize = (this.authService.hasPermission(AppPermission.FinalizeDescription) || - this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false; + this.description.authorizationFlags?.some(x => x === AppPermission.FinalizeDescription)) && this.description.belongsToCurrentTenant != false; this.canInviteDmpUsers = (this.authService.hasPermission(AppPermission.InviteDmpUsers) || - this.description.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers)) && this.description.belongsToCurrentTenant != false; + this.description.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers)) && this.description.belongsToCurrentTenant != false; // const breadCrumbs = []; // breadCrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.MY-DESCRIPTION-DESCRIPTIONS'), url: "/descriptions" }); // breadCrumbs.push({ parentComponentName: 'DescriptionListingComponent', label: this.description.label, url: '/descriptions/overview/' + this.description.id }); @@ -327,47 +326,11 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni } getSectionNameById(sectionId: Guid): string { - if (sectionId == null) return ''; - - let sections: DmpBlueprintDefinitionSection[] = this.description?.dmp?.blueprint?.definition?.sections?.filter((section:DmpBlueprintDefinitionSection) => sectionId===section.id); + if (sectionId == null) return ''; - return sections == null ? '' : sections[0].label; - } - // downloadPDF(id: string) { - // this.descriptionService.downloadPDF(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(response => { - // const blob = new Blob([response.body], { type: 'application/pdf' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); + let sections: DmpBlueprintDefinitionSection[] = this.description?.dmp?.blueprint?.definition?.sections?.filter((section: DmpBlueprintDefinitionSection) => sectionId === section.id); - // FileSaver.saveAs(blob, filename); - // this.matomoService.trackDownload('descriptions', "pdf", id); - // }); - // } - - download(id: string, format: string) { - this.descriptionService.download(id, format) - .pipe(takeUntil(this._destroyed)) - .subscribe(response => { - const blob = new Blob([response.body], { type: 'application/octet-stream' }); - const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - FileSaver.saveAs(blob, filename); - this.analyticsService.trackDownload('descriptions', format, id); - }); - } - - downloadXml(id: string) { - // TODO: add download - // this.descriptionService.downloadXML(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(response => { - // const blob = new Blob([response.body], { type: 'application/xml' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - // FileSaver.saveAs(blob, filename); - // this.matomoService.trackDownload('descriptions', "xml", id); - // }); + return sections == null ? '' : sections[0].label; } openCopyToDmpDialog() { @@ -427,35 +390,36 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni finalize(description: Description) { this.descriptionService.validate([description.id]).pipe(takeUntil(this._destroyed) - ).subscribe(result => { - if (result[0].result == DescriptionValidationOutput.Invalid){ - this.router.navigate(['descriptions/edit/' + description.id + '/finalize']); - }else{ - const dialogRef = this.dialog.open(ConfirmationDialogComponent, { - restoreFocus: false, - data: { - message: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.TITLE'), - confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.CONFIRM'), - cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.NEGATIVE'), - isDeleteConfirmation: false - } - }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { - if (result) { - const descriptionStatusPersist: DescriptionStatusPersist = { - id: description.id, - status: DescriptionStatus.Finalized, - hash: description.hash - }; - this.descriptionService.persistStatus(descriptionStatusPersist).pipe(takeUntil(this._destroyed)) - .subscribe(data => { - this.reloadPage(); - this.onUpdateCallbackSuccess() - }, (error: any) => { - this.onUpdateCallbackError(error) - }); - }}); - } + ).subscribe(result => { + if (result[0].result == DescriptionValidationOutput.Invalid) { + this.router.navigate(['descriptions/edit/' + description.id + '/finalize']); + } else { + const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + restoreFocus: false, + data: { + message: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.TITLE'), + confirmButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.CONFIRM'), + cancelButton: this.language.instant('DESCRIPTION-OVERVIEW.FINALIZE-DIALOG.NEGATIVE'), + isDeleteConfirmation: false + } + }); + dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + if (result) { + const descriptionStatusPersist: DescriptionStatusPersist = { + id: description.id, + status: DescriptionStatus.Finalized, + hash: description.hash + }; + this.descriptionService.persistStatus(descriptionStatusPersist).pipe(takeUntil(this._destroyed)) + .subscribe(data => { + this.reloadPage(); + this.onUpdateCallbackSuccess() + }, (error: any) => { + this.onUpdateCallbackError(error) + }); + } + }); + } }); } @@ -517,7 +481,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni [nameof(x => x.dmp), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.accessType)].join('.'), [nameof(x => x.dmp), nameof(x => x.status)].join('.'), - [nameof(x => x.dmp), nameof(x => x.authorizationFlags),AppPermission.InviteDmpUsers].join('.'), + [nameof(x => x.dmp), nameof(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'), [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.label)].join('.'), [nameof(x => x.dmp), nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), diff --git a/dmp-frontend/src/app/ui/dmp/dmp.module.ts b/dmp-frontend/src/app/ui/dmp/dmp.module.ts index f1ab651c3..873648ca0 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp.module.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { FormattingModule } from '@app/core/formatting.module'; import { DmpRoutingModule } from '@app/ui/dmp/dmp.routing'; -// import {GeneralTabComponent} from '@app/ui/dmp/editor/general-tab/general-tab.component'; import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; @@ -16,57 +15,5 @@ import { CommonUiModule } from '@common/ui/common-ui.module'; ], exports: [ ] - // imports: [ - // CommonUiModule, - // CommonFormsModule, - // ConfirmationDialogModule, - // FormattingModule, - // AutoCompleteModule, - // DmpRoutingModule, - // DmpOverviewModule, - // FormValidationErrorsDialogModule, - // MultipleChoiceDialogModule, - // DatasetEditorDetailsModule, - // DatasetDescriptionFormModule, - // NgxDropzoneModule, - // FormProgressIndicationModule, - // RichTextEditorModule - // ], - // declarations: [ - // DmpListingComponent, - // DmpCriteriaComponent, - // DmpEditorComponent, - // InvitationAcceptedComponent, - // DmpToDatasetDialogComponent, - // DmpWizardComponent, - // DmpWizardEditorComponent, - // DmpWizardDatasetListingComponent, - // AddResearcherComponent, - // AvailableProfilesComponent, - // DmpFinalizeDialogComponent, - // DynamicFieldsGrantComponent, - // DynamicFieldGrantComponent, - // DmpUploadDialogue, - // DmpListingItemComponent, - // PeopleTabComponent, - // GrantTabComponent, - // DatasetsTabComponent, - // DmpCloneComponent, - // AddOrganizationComponent, - // DmpCriteriaDialogComponent, - // AddCostComponent, - // CostListingComponent, - // StartNewDmpDialogComponent, - // StartNewDatasetDialogComponent, - // MainInfoComponent, - // FundingInfoComponent, - // DatasetInfoComponent, - // LicenseInfoComponent, - // DatasetPreviewDialogComponent, - // DmpEditorBlueprintComponent - // ], - // exports: [ - // DmpListingItemComponent - // ] }) export class DmpModule { } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.html b/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.html deleted file mode 100644 index b6348e29c..000000000 --- a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.html +++ /dev/null @@ -1,112 +0,0 @@ -
-
- {{'DATASET-EDITOR.TITLE.INTRO' | translate}} -
-
- -
-
-
1.1 {{'DATASET-EDITOR.FIELDS.TITLE' | translate}}*
- {{'DATASET-EDITOR.HINT.TITLE' | translate}} - {{'DATASET-EDITOR.FIELDS.DMP' | translate}} - {{'DATASET-EDITOR.HINT.TITLE-REST' | translate}} -
- - - {{formGroup.get('label').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
-
- -
-
-
1.2 {{'DATASET-EDITOR.FIELDS.DESCRIPTION' | translate}}
- {{'DATASET-EDITOR.HINT.DESCRIPTION' | translate}} - -
- - - {{formGroup.get('description').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
-
- - - - - -
1.5 {{'DATASET-EDITOR.FIELDS.PROFILE' | translate}}*
-
- - - - {{profile.label}} - - - {{formGroup.get('profile').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
- -
- -
- - - -
-
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.scss b/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.scss deleted file mode 100644 index 9d2f3fdf7..000000000 --- a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.scss +++ /dev/null @@ -1,109 +0,0 @@ -.dataset-editor-details { - // position: relative; - // left: 362px; - // width: calc(100% - 366px); - - .intro { - text-align: left; - font-weight: 400; - letter-spacing: 0px; - color: #212121; - opacity: 1; - margin: 3rem 0rem 3rem 0rem; - } - - .heading { - text-align: left; - font-weight: 700; - font-size: 18px; - letter-spacing: 0px; - color: #212121; - opacity: 0.81; - margin-top: 1.625rem; - margin-bottom: 0.625rem; - } - - .hint { - text-align: left; - font-weight: 400; - font-size: 16px; - letter-spacing: 0px; - color: #212121; - opacity: 0.81; - margin-bottom: 2.125rem; - } - - .title-form, - .description-form, - .profile-form { - text-align: left; - font-weight: 400; - font-size: 16px; - letter-spacing: 0.15px; - color: #7d7d7d; - opacity: 1; - margin-bottom: 1rem; - } - - // textarea::placeholder { - // font-style: oblique; - // } - - .input-btn { - border: none; - color: #aaaaaa; - background-color: #ffffff00; - cursor: pointer; - } - - .input-btn :hover { - color: var(--primary-color-3) !important; - } - - .dmp-link { - color: #3fafac; - font-weight: 400; - font-size: 16px; - cursor: pointer; - } - - .dmp-link:hover { - text-decoration: underline; - } -} - -::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-outline { - background: #fafafa !important; -} - -::ng-deep .description-form .mat-form-field-appearance-outline .mat-form-field-outline { - background: #fafafa !important; -} - -::ng-deep .uri-form .mat-form-field-appearance-outline .mat-form-field-outline { - background: #fafafa !important; -} - -::ng-deep .tags-form .mat-form-field-appearance-outline .mat-form-field-outline { - background: #fafafa !important; -} - -::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-infix { - font-size: 1rem; - padding: 0.6em 0 1em 0 !important; -} - -::ng-deep .description-form .mat-form-field-appearance-outline .mat-form-field-infix { -// font-size: 1rem; - padding: 0.6em 0 1em 0 !important; -} - -::ng-deep .uri-form .mat-form-field-appearance-outline .mat-form-field-infix { - font-size: 1rem; - padding: 0.6em 0 1em 0 !important; -} - -::ng-deep .tags-form .mat-form-field-appearance-outline .mat-form-field-infix { - font-size: 1rem; - padding: 0.6em 0 1em 0 !important; -} diff --git a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts deleted file mode 100644 index 9c26e407a..000000000 --- a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts +++ /dev/null @@ -1,278 +0,0 @@ -import { BaseComponent } from '@common/base/base.component'; -import { OnInit, Component, Input, Output, EventEmitter } from '@angular/core'; -import { TranslateService } from '@ngx-translate/core'; -import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; -import { MatChipInputEvent } from '@angular/material/chips'; -import { MatDialog } from '@angular/material/dialog'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { ActivatedRoute, Router } from '@angular/router'; -import { DmpService } from '@app/core/services/dmp/dmp.service'; -import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service'; -import { FormService } from '@common/forms/form-service'; -import { LockService } from '@app/core/services/lock/lock.service'; -import { AuthService } from '@app/core/services/auth/auth.service'; -import { UntypedFormGroup, FormControl, UntypedFormArray } from '@angular/forms'; -import { takeUntil, map, catchError } from 'rxjs/operators'; -import { RequestItem } from '@app/core/query/request-item'; -import { isNullOrUndefined } from '@app/utilities/enhancers/utils'; -import { interval, Observable, of as observableOf } from 'rxjs'; -import { Guid } from '@common/types/guid'; -import { Location } from '@angular/common'; -import { ENTER, COMMA } from '@angular/cdk/keycodes'; -import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants'; -import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service'; -import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; -import { AvailableProfilesComponent } from '../available-profiles/available-profiles.component'; - - -@Component({ - selector: 'dataset-editor-details', - templateUrl: './dataset-editor-details.component.html', - styleUrls: ['./dataset-editor-details.component.scss'] -}) -export class DatasetEditorDetailsComponent extends BaseComponent implements OnInit { - - viewOnly = false; - editMode = false; - // publicMode = false; - - // DatasetStatus = DatasetStatus; - // dmpAutoCompleteConfiguration: SingleAutoCompleteConfiguration; - - datasetWizardModel: DatasetWizardEditorModel; - // isNew = true; - // isCopy = false; - // formGroup: FormGroup = null; - datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel; - - // availableProfiles: DatasetProfileModel[] = []; - // itemId: string; - // publicId: string; - // profileUpdateId: string; - // downloadDocumentId: string; - // isLinear = false; - lock: LockModel; - lockStatus: Boolean; - dmpText: string = null; - - @Input() formGroup: UntypedFormGroup; - @Input() dmpId: string; - @Input() datasetId: string; - @Input() availableProfiles: DatasetProfileModel[]; - @Output() formChanged: EventEmitter = new EventEmitter(); - readonly separatorKeysCodes: number[] = [ENTER, COMMA]; - - profilesAutoCompleteConfiguration: MultipleAutoCompleteConfiguration; - - constructor( - private datasetWizardService: DatasetWizardService, - private route: ActivatedRoute, - public snackBar: MatSnackBar, - public router: Router, - private language: TranslateService, - private configurationService: ConfigurationService, - private externalSourcesService: ExternalSourcesService, - private dialog: MatDialog, - public dmpService: DmpService, - public externalSourcesConfigurationService: ExternalSourcesConfigurationService, - private uiNotificationService: UiNotificationService, - private formService: FormService, - private lockService: LockService, - private location: Location, - private authService: AuthService, - private guidedTourService: GuidedTourService - ) { - super(); - } - - ngOnInit() { - - if (this.formGroup.get('status').value === 1) { - this.formGroup.disable(); - } - - this.datasetWizardModel = new DatasetWizardEditorModel(); - - this.profilesAutoCompleteConfiguration = { - filterFn: this.filterProfiles.bind(this), - initialItems: (excludedItems: any[]) => this.filterProfiles('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))), - displayFn: (item) => item['label'], - titleFn: (item) => item['label'], - subtitleFn: (item) => item['description'], - popupItemActionIcon: 'visibility' - }; - } - - public dashboardTourDmp: GuidedTour = { - tourId: 'only-dmp-tour', - useOrb: true, - steps: [ - { - title: this.dmpText, - content: 'Step 1', - orientation: Orientation.Bottom, - highlightPadding: 3, - isStepUnique: true, - customTopOffset: 8 - } - ] - }; - - getDmpText(): string { - return this.language.instant('DMP-LISTING.TEXT-INFO') + '\n\n' + - this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' + - this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' + - this.language.instant('DMP-LISTING.GET-IDEA'); - } - - setDashboardTourDmp(label: string): void { - this.dashboardTourDmp.steps[0].title = this.getDmpText(); - this.dashboardTourDmp.steps[0].selector = '.dmp-tour-' + label; - } - - public restartTour(label: string): void { - this.setDashboardTourDmp(label); - this.guidedTourService.startTour(this.dashboardTourDmp); - - } - - registerFormListeners() { - // this.formGroup.get('dmp').valueChanges - // .pipe(takeUntil(this._destroyed)) - // .subscribe(x => { - // this.dmpValueChanged(x); - // }); - - // if (this.isNewDataset) { - // this.formGroup.get('profile').valueChanges - // .pipe(takeUntil(this._destroyed)) - // .subscribe(x => { - // if (!isNullOrUndefined(x)) { - // this.datasetProfileValueChanged(x.id); - // } - // }); - // } - } - - dmpValueChanged(dmp: DmpListingModel) { - if (dmp) { - this.formGroup.get('profile').enable(); - this.loadDatasetProfiles(); - } - else { - this.availableProfiles = []; - this.formGroup.get('profile').reset(); - this.formGroup.get('profile').disable(); - this.formGroup.removeControl('datasetProfileDefinition'); - } - } - - datasetProfileValueChanged(profileId: string) { - if (profileId && profileId.length > 0) { - this.formGroup.removeControl('datasetProfileDefinition'); - this.getDefinition(profileId); - } - } - - onChanges(): void { - this.formGroup.valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(val => { - // this.formChanged.emit(val); - }); - } - - onFormChanged(event) { - // this.formChanged.emit(event); - } - - getDefinition(profileId: string) { - // if (this.formGroup.invalid) { setTimeout(() => this.stepper.selectedIndex = 0); return; } - this.datasetWizardService.getDefinition(profileId) - .pipe(takeUntil(this._destroyed)) - .subscribe(item => { - this.datasetWizardModel.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item); - this.datasetProfileDefinitionModel = this.datasetWizardModel.datasetProfileDefinition; - this.formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinitionModel.buildForm()); - }); - } - - loadDatasetProfiles() { - const datasetProfileRequestItem: RequestItem = new RequestItem(); - datasetProfileRequestItem.criteria = new DatasetProfileCriteria(); - datasetProfileRequestItem.criteria.id = this.dmpId; - if (datasetProfileRequestItem.criteria.id) { - this.datasetWizardService.getAvailableProfiles(datasetProfileRequestItem) - .pipe(takeUntil(this._destroyed)) - .subscribe(items => { - this.availableProfiles = items; - }); - } - } - - needsUpdate() { - if (this.datasetWizardModel.isProfileLatestVersion || (this.datasetWizardModel.status === DatasetStatus.Finalized) - || (this.datasetWizardModel.isProfileLatestVersion == undefined && this.datasetWizardModel.status == undefined)) { - return false; - } - else { - return true; - } - } - - private pumpLock() { - this.lock.touchedAt = new Date(); - this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => { - if (!isNullOrUndefined(result)) { - this.lock.id = Guid.parse(result); - } else { - this.location.back(); - } - }); - } - - removeTag(tag: any) { - (this.formGroup.get('tags')).removeAt(((this.formGroup.get('tags')).value as any[]).indexOf(tag)); - } - - addTag(ev: MatChipInputEvent) { - if (ev.value !== '' && isNullOrUndefined(((this.formGroup.get('tags')).value as ExternalTagEditorModel[]).find(tag => tag.name === ev.value))) { - (this.formGroup.get('tags')).push(new ExternalTagEditorModel('', ev.value).buildForm()); - } - ev.input.value = ''; - } - - getProfileId(): string { - if (!isNullOrUndefined(this.formGroup.get('profile').value)) { - return this.formGroup.get('profile').value.id; - } else { - return undefined; - } - } - - hasProfileId(): boolean { - return !isNullOrUndefined(this.getProfileId()); - } - - filterProfiles(value: string): Observable { - const request = new DataTableRequest(null, null, { fields: ['+label'] }); - const criteria = new DatasetProfileCriteria(); - criteria.like = value; - request.criteria = criteria; - return this.dmpService.searchDmpBlueprints(request); - } - - allAvailableProfiles(event: MouseEvent) { - event.stopPropagation(); - const dialogRef = this.dialog.open(AvailableProfilesComponent, { - data: { - profiles: this.formGroup.get('profiles') - } - }); - return false; - } - - public compareWith(object1: any, object2: any) { - return object1 && object2 && object1.id === object2.id; - } -} diff --git a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.module.ts b/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.module.ts deleted file mode 100644 index ac6563f04..000000000 --- a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.module.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FormattingModule } from '@app/core/formatting.module'; -import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; -import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module'; -import { DmpRoutingModule } from '@app/ui/dmp/dmp.routing'; -import { DmpOverviewModule } from '@app/ui/dmp/overview/dmp-overview.module'; -import { CommonFormsModule } from '@common/forms/common-forms.module'; -import { FormValidationErrorsDialogModule } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.module'; -import { CommonUiModule } from '@common/ui/common-ui.module'; -import { MultipleChoiceDialogModule } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.module'; -import { DatasetEditorDetailsComponent } from './dataset-editor-details.component'; - - -@NgModule({ - imports: [ - CommonUiModule, - CommonFormsModule, - ConfirmationDialogModule, - FormattingModule, - AutoCompleteModule, - DmpRoutingModule, - DmpOverviewModule, - FormValidationErrorsDialogModule, - MultipleChoiceDialogModule, - ], - declarations: [ - DatasetEditorDetailsComponent - ], - exports: [ - DatasetEditorDetailsComponent - ] -}) -export class DatasetEditorDetailsModule { } diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index 1e1689ae3..0375446f9 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -14,17 +14,26 @@ import { Location } from '@angular/common'; import { DescriptionStatus } from '@app/core/common/enum/description-status'; import { DmpAccessType } from '@app/core/common/enum/dmp-access-type'; import { DmpUserRole } from '@app/core/common/enum/dmp-user-role'; +import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status'; +import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; +import { AppPermission } from '@app/core/common/enum/permission.enum'; import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration'; +import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { Description } from '@app/core/model/description/description'; +import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { Dmp, DmpDescriptionTemplate, DmpUser, DmpUserRemovePersist } from '@app/core/model/dmp/dmp'; import { DmpReference } from '@app/core/model/dmp/dmp-reference'; import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; +import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { DepositService } from '@app/core/services/deposit/deposit.service'; import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service'; import { FileTransformerService } from '@app/core/services/file-transformer/file-transformer.service'; import { LockService } from '@app/core/services/lock/lock.service'; +import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; +import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; import { ReferenceService } from '@app/core/services/reference/reference.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { FileUtils } from '@app/core/services/utilities/file-utils.service'; @@ -32,24 +41,14 @@ import { PopupNotificationDialogComponent } from '@app/library/notification/popu import { BaseComponent } from '@common/base/base.component'; import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; -import * as FileSaver from 'file-saver'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; -import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component'; -import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; -import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { CloneDmpDialogComponent } from '../clone-dialog/dmp-clone-dialog.component'; -import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-version-dialog.component'; -import { AppPermission } from '@app/core/common/enum/permission.enum'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { IsActive } from '@app/core/common/enum/is-active.enum'; -import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component'; -import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver'; -import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; -import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status'; import { DmpDeleteDialogComponent } from '../dmp-delete-dialog/dmp-delete-dialog.component'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; -import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; +import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver'; +import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component'; +import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component'; +import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-version-dialog.component'; @Component({ selector: 'app-dmp-overview', @@ -232,16 +231,16 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { this.authorFocus = null; } - canEditDmp(): boolean{ - return (this.isDraftDmp()) && (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authentication.hasPermission(AppPermission.EditDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + canEditDmp(): boolean { + return (this.isDraftDmp()) && (this.dmp.authorizationFlags?.some(x => x === AppPermission.EditDmp) || this.authentication.hasPermission(AppPermission.EditDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canCreateNewVersion(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionDmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp)) && this.dmp.versionStatus === DmpVersionStatus.Current && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionDmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp)) && this.dmp.versionStatus === DmpVersionStatus.Current && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canDeleteDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DeleteDmp) || this.authentication.hasPermission(AppPermission.DeleteDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DeleteDmp) || this.authentication.hasPermission(AppPermission.DeleteDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canCloneDmp(): boolean { @@ -249,7 +248,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } canFinalizeDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizeDmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.FinalizeDmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canExportDmp(): boolean { @@ -257,15 +256,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } canInviteDmpUsers(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers) || this.authentication.hasPermission(AppPermission.InviteDmpUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.InviteDmpUsers) || this.authentication.hasPermission(AppPermission.InviteDmpUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canAssignDmpUsers(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignDmpUsers) || this.authentication.hasPermission(AppPermission.AssignDmpUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.AssignDmpUsers) || this.authentication.hasPermission(AppPermission.AssignDmpUsers)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } canDepositDmp(): boolean { - return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DepositDmp) || this.authentication.hasPermission(AppPermission.DepositDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; + return (this.dmp.authorizationFlags?.some(x => x === AppPermission.DepositDmp) || this.authentication.hasPermission(AppPermission.DepositDmp)) && this.isPublicView == false && this.dmp.belongsToCurrentTenant != false; } @@ -391,7 +390,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { deleteClicked() { let dialogRef: any; - if (this.dmp.descriptions && this.dmp.descriptions.length > 0){ + if (this.dmp.descriptions && this.dmp.descriptions.length > 0) { dialogRef = this.dialog.open(DmpDeleteDialogComponent, { maxWidth: '300px', data: { @@ -440,50 +439,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { this.uiNotificationService.snackBarNotification(error.error.error ? error.error.error : this.language.instant('DATASET-UPLOAD.SNACK-BAR.UNSUCCESSFUL'), SnackBarNotificationLevel.Error); } - downloadXml(id: string) { - // this.dmpService.downloadXML(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(response => { - // const blob = new Blob([response.body], { type: 'application/xml' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - // FileSaver.saveAs(blob, filename); - // this.matomoService.trackDownload('dmps', "xml", id); - // }); - } - - download(id: string, format: string) { - this.dmpService.download(id, format) - .pipe(takeUntil(this._destroyed)) - .subscribe(response => { - const blob = new Blob([response.body], { type: 'application/octet-stream' }); - const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition')); - - FileSaver.saveAs(blob, filename); - this.analyticsService.trackDownload('dmps', format, id); - }); - } - - downloadJson(id: string) { - //TODO: add this - // this.dmpService.downloadJson(id) - // .pipe(takeUntil(this._destroyed)) - // .subscribe(complete => { - // const blob = new Blob([complete.body], { type: 'application/json' }); - // const filename = this.fileUtils.getFilenameFromContentDispositionHeader(complete.headers.get('Content-Disposition')); - // FileSaver.saveAs(blob, filename); - // this.matomoService.trackDownload('dmps', "json", id); - // }, async error => { - // this.onExportCallbackError(error); - // }); - } - - // async onExportCallbackError(error: any) { - // const errorJsonText = await error.error.text(); - // const errorObj = JSON.parse(errorJsonText); - // this.uiNotificationService.snackBarNotification(errorObj.message, SnackBarNotificationLevel.Error); - // } - isUserDmpRelated(): boolean { const principalId: Guid = this.authentication.userId(); return this.dmp.dmpUsers?.some(x => (x.user.id === principalId)); @@ -726,11 +681,11 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } getSectionNameById(sectionId: Guid): string { - if (sectionId == null) return ''; - - let sections: DmpBlueprintDefinitionSection[] = this.dmp?.blueprint?.definition?.sections?.filter((section:DmpBlueprintDefinitionSection) => sectionId===section.id); + if (sectionId == null) return ''; - return sections == null ? '' : sections[0].label; + let sections: DmpBlueprintDefinitionSection[] = this.dmp?.blueprint?.definition?.sections?.filter((section: DmpBlueprintDefinitionSection) => sectionId === section.id); + + return sections == null ? '' : sections[0].label; } checkLockStatus(id: Guid) { diff --git a/dmp-frontend/src/app/ui/navbar/navbar.component.ts b/dmp-frontend/src/app/ui/navbar/navbar.component.ts index dec52e62c..b1eb2cf42 100644 --- a/dmp-frontend/src/app/ui/navbar/navbar.component.ts +++ b/dmp-frontend/src/app/ui/navbar/navbar.component.ts @@ -2,30 +2,30 @@ import { Location } from '@angular/common'; import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'; import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatMenuTrigger } from '@angular/material/menu'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import { Router } from '@angular/router'; import { AppRole } from '@app/core/common/enum/app-role'; +import { TenantConfigurationType } from '@app/core/common/enum/tenant-configuration-type'; +import { StorageFile } from '@app/core/model/storage-file/storage-file'; +import { LogoTenantConfiguration, TenantConfiguration } from '@app/core/model/tenant-configuaration/tenant-configuration'; import { User } from '@app/core/model/user/user'; import { AuthService, LoginStatus } from '@app/core/services/auth/auth.service'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { LanguageService } from '@app/core/services/language/language.service'; +import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { ProgressIndicationService } from '@app/core/services/progress-indication/progress-indication-service'; import { SideNavService } from '@app/core/services/sidenav/side-nav.sevice'; +import { StorageFileService } from '@app/core/services/storage-file/storage-file.service'; +import { TenantConfigurationService } from '@app/core/services/tenant-configuration/tenant-configuration.service'; import { BaseComponent } from '@common/base/base.component'; +import { InAppNotificationService } from '@notification-service/services/http/inapp-notification.service'; +import { MineInAppNotificationListingDialogComponent } from '@notification-service/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component'; +import { timer } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; +import { nameof } from 'ts-simple-nameof'; import { StartNewDmpDialogComponent } from '../dmp/new/start-new-dmp-dialogue/start-new-dmp-dialog.component'; import { FaqDialogComponent } from '../faq/dialog/faq-dialog.component'; import { UserDialogComponent } from './user-dialog/user-dialog.component'; -import { MineInAppNotificationListingDialogComponent } from '@notification-service/ui/inapp-notification/listing-dialog/mine-inapp-notification-listing-dialog.component'; -import { InAppNotificationService } from '@notification-service/services/http/inapp-notification.service'; -import { timer } from 'rxjs'; -import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; -import { TenantConfigurationService } from '@app/core/services/tenant-configuration/tenant-configuration.service'; -import { LogoTenantConfiguration, TenantConfiguration } from '@app/core/model/tenant-configuaration/tenant-configuration'; -import { TenantConfigurationType } from '@app/core/common/enum/tenant-configuration-type'; -import { nameof } from 'ts-simple-nameof'; -import { StorageFile } from '@app/core/model/storage-file/storage-file'; -import { StorageFileService } from '@app/core/services/storage-file/storage-file.service'; -import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @Component({ selector: 'app-navbar', @@ -109,22 +109,22 @@ export class NavbarComponent extends BaseComponent implements OnInit { private loadLogo() { if (this.authentication.currentAccountIsAuthenticated() && this.authentication.selectedTenant()) { - this.tenantConfigurationService.getCurrentTenantType(TenantConfigurationType.Logo, [ + this.tenantConfigurationService.getCurrentTenantType(TenantConfigurationType.Logo, [ nameof(x => x.type), [nameof(x => x.logo), nameof(x => x.storageFile), nameof(x => x.id)].join('.'), ]) - .pipe(map(data => data as TenantConfiguration), takeUntil(this._destroyed)) - .subscribe( - data => { - if (data?.logo?.storageFile?.id) { - this.storageFileService.download(data?.logo?.storageFile?.id).pipe(takeUntil(this._destroyed)) - .subscribe(response => { - const blob = new Blob([response.body]); - this.extraImageURL = this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(response.body)) - }); - } - }, - ); + .pipe(map(data => data as TenantConfiguration), takeUntil(this._destroyed)) + .subscribe( + data => { + if (data?.logo?.storageFile?.id) { + this.storageFileService.download(data?.logo?.storageFile?.id).pipe(takeUntil(this._destroyed)) + .subscribe(response => { + const blob = new Blob([response.body]); + this.extraImageURL = this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(response.body)) + }); + } + }, + ); } } diff --git a/dmp-frontend/src/app/ui/user-profile/add-account/add-account-dialog.component.ts b/dmp-frontend/src/app/ui/user-profile/add-account/add-account-dialog.component.ts index 856300188..697768731 100644 --- a/dmp-frontend/src/app/ui/user-profile/add-account/add-account-dialog.component.ts +++ b/dmp-frontend/src/app/ui/user-profile/add-account/add-account-dialog.component.ts @@ -9,14 +9,10 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; }) export class AddAccountDialogComponent implements OnInit { - //TODO: refactor datasetProfileDefinitionModel: any; datasetProfileDefinitionFormGroup: UntypedFormGroup; progressIndication = false; form: FormGroup; - // public hasEmail = true; - //TODO: refactor - // private request: any; constructor( private formBuilder: FormBuilder, @@ -28,18 +24,6 @@ export class AddAccountDialogComponent implements OnInit { this.form = this.formBuilder.group({ email: [this.data.email, [Validators.required, Validators.email]] }); - - //TODO refactor - // this.mergeLoginService.getObservable().subscribe(result => { - // if (result !== undefined) { - // if (!(result.email !== undefined && result.email !== null)) { - // this.request = result; - // this.hasEmail = false; - // } else { - // this.dialogRef.close(result); - // } - // } - // }); } add(): void { diff --git a/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts b/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts index b415aab3d..7608a9de7 100644 --- a/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts +++ b/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts @@ -1,44 +1,42 @@ -import { HttpClient, HttpErrorResponse } from '@angular/common/http'; +import { HttpErrorResponse } from '@angular/common/http'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; -import { ActivatedRoute, Params, Router } from '@angular/router'; +import { ActivatedRoute, Params } from '@angular/router'; import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type'; import { CultureInfo } from '@app/core/model/culture-info'; +import { ReferenceType } from '@app/core/model/reference-type/reference-type'; import { Reference } from '@app/core/model/reference/reference'; +import { Tenant } from '@app/core/model/tenant/tenant'; import { User, UserAdditionalInfo, UserCredential, UserPersist } from '@app/core/model/user/user'; import { AuthService } from '@app/core/services/auth/auth.service'; import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { CultureService } from '@app/core/services/culture/culture-service'; +import { PrincipalService } from '@app/core/services/http/principal.service'; import { LanguageService } from '@app/core/services/language/language.service'; +import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service'; +import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; +import { ReferenceService } from '@app/core/services/reference/reference.service'; import { UserService } from '@app/core/services/user/user.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; -import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; +import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { PopupNotificationDialogComponent } from "@app/library/notification/popup/popup-notification.component"; import { BaseComponent } from '@common/base/base.component'; +import { FormService } from '@common/forms/form-service'; import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component'; +import { BaseHttpParams } from '@common/http/base-http-params'; +import { InterceptorType } from '@common/http/interceptors/interceptor-type'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; +import { Guid } from '@common/types/guid'; import { TranslateService } from '@ngx-translate/core'; +import { KeycloakService } from 'keycloak-angular'; import * as moment from 'moment-timezone'; import { Observable, from, of } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; +import { nameof } from 'ts-simple-nameof'; import { AddAccountDialogComponent } from './add-account/add-account-dialog.component'; import { UserProfileEditorModel } from './user-profile-editor.model'; -import { nameof } from 'ts-simple-nameof'; -import { Guid } from '@common/types/guid'; -import { BaseHttpParams } from '@common/http/base-http-params'; -import { InterceptorType } from '@common/http/interceptors/interceptor-type'; -import { PrincipalService } from '@app/core/services/http/principal.service'; -import { KeycloakService } from 'keycloak-angular'; -import { FormService } from '@common/forms/form-service'; -import { ReferenceService } from '@app/core/services/reference/reference.service'; -import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service'; -import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; -import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type'; -import { ReferenceType } from '@app/core/model/reference-type/reference-type'; -import { Tenant } from '@app/core/model/tenant/tenant'; -import { AnalyticsService } from '@app/core/services/matomo/analytics-service'; @Component({ selector: 'app-user-profile', @@ -73,17 +71,14 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes constructor( private userService: UserService, private route: ActivatedRoute, - private router: Router, private authService: AuthService, private language: TranslateService, private cultureService: CultureService, - private authentication: AuthService, private languageService: LanguageService, private configurationService: ConfigurationService, private uiNotificationService: UiNotificationService, private dialog: MatDialog, public enumUtils: EnumUtils, - private httpClient: HttpClient, private formBuilder: UntypedFormBuilder, private keycloakService: KeycloakService, private principalService: PrincipalService, @@ -97,7 +92,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes } - public getProviderIcons(userCredential: UserCredential, culture:string): string[] { + public getProviderIcons(userCredential: UserCredential, culture: string): string[] { if (userCredential.data.externalProviderNames === undefined || userCredential.data.externalProviderNames?.length === 0) { return [this.configurationService.authProviders.defaultAuthProvider.providerClass]; @@ -125,62 +120,37 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes .pipe(takeUntil(this._destroyed)) .subscribe((params: Params) => { this.getOrRefreshData(); - - //TODO: refactor - // this.userService.getEmails(userId).pipe(takeUntil(this._destroyed)) - // .subscribe(result => { - // this.user.subscribe(x => { - // const mainEmail = result.filter(el => el.email === x.email) - // const otherEmails = result.filter(el => el.email !== x.email) - // this.userCredentials = [...mainEmail, ...otherEmails]; - // } - // ) - // }); }); } - getOrRefreshData(){ + getOrRefreshData() { this.currentUserId = this.authService.userId()?.toString(); this.user = this.userService.getSingle( - Guid.parse(this.currentUserId), - [ - nameof(x => x.id), - nameof(x => x.name), - nameof(x => x.additionalInfo.language), - nameof(x => x.additionalInfo.timezone), - nameof(x => x.additionalInfo.culture), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.id)].join('.'), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.label)].join('.'), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.type), nameof(x => x.id)].join('.'), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.reference)].join('.'), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.source)].join('.'), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.sourceType)].join('.'), - [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.isActive)].join('.'), - nameof(x => x.additionalInfo.roleOrganization), - nameof(x => x.createdAt), - nameof(x => x.updatedAt), - nameof(x => x.hash), - `${nameof(x => x.credentials)}.${nameof(x => x.id)}`, - `${nameof(x => x.credentials)}.${nameof(x => x.data.email)}`, - `${nameof(x => x.credentials)}.${nameof(x => x.data.externalProviderNames)}`, - ] - ) + Guid.parse(this.currentUserId), + [ + nameof(x => x.id), + nameof(x => x.name), + nameof(x => x.additionalInfo.language), + nameof(x => x.additionalInfo.timezone), + nameof(x => x.additionalInfo.culture), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.id)].join('.'), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.label)].join('.'), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.type), nameof(x => x.id)].join('.'), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.reference)].join('.'), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.source)].join('.'), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.sourceType)].join('.'), + [nameof(x => x.additionalInfo), nameof(x => x.organization), nameof(x => x.isActive)].join('.'), + nameof(x => x.additionalInfo.roleOrganization), + nameof(x => x.createdAt), + nameof(x => x.updatedAt), + nameof(x => x.hash), + `${nameof(x => x.credentials)}.${nameof(x => x.id)}`, + `${nameof(x => x.credentials)}.${nameof(x => x.data.email)}`, + `${nameof(x => x.credentials)}.${nameof(x => x.data.externalProviderNames)}`, + ] + ) .pipe(map(result => { - //tested ui with fake data - // const fakecredentials: UserCredential = { - // "id": Guid.createEmpty(), - // "externalId": "123", - // "user": null, - // "createdAt": new Date(), - // "data": { - // "email": "dmpadmin@dmp.com", - // "externalProviderNames": ["Google", "Facebook"] - // } - // }; - // result.credentials.push(fakecredentials); - // result.credentials[0].data.externalProviderNames = ['Google']; - this.userLanguage = result.additionalInfo.language; this.firstEmail = result.credentials[0].data.email; this.userCredentials = of(result.credentials); @@ -188,14 +158,12 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes this.userProfileEditorModel = new UserProfileEditorModel().fromModel(result); this.formGroup = this.userProfileEditorModel.buildForm(this.languageService.getAvailableLanguagesCodes()); - //this.formGroup.get('language').valueChanges.pipe(takeUntil(this._destroyed)).subscribe(x => { if (x) this.translate.use(x.value) }) this.formGroup.get('additionalInfo').get('timezone').valueChanges .pipe(takeUntil(this._destroyed)) .subscribe(x => { if (x) { this.timezones = this._filterTimezone(x); } }); this.formGroup.get('additionalInfo').get('culture').valueChanges .pipe(takeUntil(this._destroyed)) .subscribe(x => { if (x) { this.cultures = this._filterCulture(x); } }); - // this.initializeDisabledFormGroup(); this.tenants = this.loadUserTenants(); this.unlock(); @@ -234,7 +202,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes if (culture == null || culture.displayName == null - || culture.nativeName == null) + || culture.nativeName == null) return undefined; return culture.displayName + '-' + culture.nativeName; @@ -263,7 +231,6 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes .pipe(takeUntil(this._destroyed)) .subscribe(result => { this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); - // this.router.navigate(['/profile']); window.location.reload(); }); }, @@ -275,30 +242,6 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes this.formGroup.enable(); } - public initializeDisabledFormGroup() { - this.formGroup.disable(); - } - - public lock() { - if (!this.formGroup.valid) { return; } - //TODO: refactor - // this.userService.updateUserSettings(this.formGroup.value) - // .pipe(takeUntil(this._destroyed)) - // .subscribe( - // x => { - // this.editMode = false; - // this.languageService.changeLanguage(this.formGroup.value.language.value); - // this.formGroup.disable(); - // this.authService.refresh() - // .pipe(takeUntil(this._destroyed)) - // .subscribe(result => this.router.navigate(['/profile'])); - // // .subscribe(result => window.location.reload()); - // }, - // error => { - // console.log(error); - // }); - } - private showValidationErrorsDialog(projectOnly?: boolean) { const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, { disableClose: true, @@ -332,11 +275,11 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes this.dialog.open(PopupNotificationDialogComponent, { data: { title: this.language.instant('USER-PROFILE.UNLINK-ACCOUNT.TITLE'), - message: this.language.instant('USER-PROFILE.UNLINK-ACCOUNT.MESSAGE', {'accountToBeUnlinked': userCredential.data?.email}) + message: this.language.instant('USER-PROFILE.UNLINK-ACCOUNT.MESSAGE', { 'accountToBeUnlinked': userCredential.data?.email }) }, maxWidth: '30em' }); }, - error => this.onCallbackError(error)); + error => this.onCallbackError(error)); } }); } @@ -349,8 +292,6 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes const dialogRef = this.dialog.open(AddAccountDialogComponent, { restoreFocus: false, autoFocus: false, - // width: '653px', - // maxHeight: '90vh', width: '30%', minWidth: 'fit-content', data: { @@ -360,29 +301,17 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { this.userService.mergeAccount({ email: result.email }) - .subscribe(result => { - if (result) { - this.dialog.open(PopupNotificationDialogComponent, { - data: { - title: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.TITLE'), - message: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.MESSAGE') - }, maxWidth: '30em' - }); - } - }, - error => this.onCallbackError(error)); //TODO how to handle this - - - //TODO refactor - // this.mergeEmailConfirmation.sendConfirmationEmail(result).pipe(takeUntil(this._destroyed)) - // .subscribe(res => { - // this.dialog.open(PopupNotificationDialogComponent, { - // data: { - // title: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.TITLE'), - // message: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.MESSAGE') - // }, maxWidth: '30em' - // }); - // }, err => { }); + .subscribe(result => { + if (result) { + this.dialog.open(PopupNotificationDialogComponent, { + data: { + title: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.TITLE'), + message: this.language.instant('USER-PROFILE.MERGING-EMAILS-DIALOG.MESSAGE') + }, maxWidth: '30em' + }); + } + }, + error => this.onCallbackError(error)); //TODO how to handle this } }); } diff --git a/dmp-frontend/src/assets/scss/core/mixins/_forms.scss b/dmp-frontend/src/assets/scss/core/mixins/_forms.scss index 47c1f67ab..785f07399 100644 --- a/dmp-frontend/src/assets/scss/core/mixins/_forms.scss +++ b/dmp-frontend/src/assets/scss/core/mixins/_forms.scss @@ -204,36 +204,6 @@ $label-placeholder-top: $label-top-margin + $static-font-size + $variant-padding-y; - //@debug "font-size: #{$font-size} static-font-size: #{$static-font-size} help-font-size: #{$help-font-size} form-group-context: #{$form-group-context} "; - - //Label height: 72dp - //Padding above label text: 16dp - //Padding between label and input text: 8dp - //Padding below input text (including divider): 16dp - //Padding below text divider: 8dp - - // @if $form-group-context { - // // Create a space at the top of the bmd-form-group for the label. - // // The label is absolutely positioned, so we use top padding to make space. This padding extends over the label down to the top of the input (padding). - // padding-top: ($label-top-margin + $static-font-size); - // // note: bottom-margin of this is determined by $spacer. @see _spacer.scss - // //margin-bottom: (1.5 * $help-font-size); - // } - - // TODO: remove this when known stable. https://github.com/FezVrasta/bootstrap-material-design/issues/849 - //@else { - // - // // for radios and checkboxes without a form-group, add some extra vertical spacing to pad down so that - // // any help text above is not encroached upon, or so that it appears more evenly spaced vs form-groups - // .radio, - // label.radio-inline, - // .checkbox, - // label.checkbox-inline, - // .switch { - // padding-top: $spacer-y; - // } - //} - // Set all line-heights preferably to 1 so that we can space out everything manually without additional added space // from the default line-height of 1.5 .form-control, diff --git a/dmp-frontend/src/common/forms/form-service.ts b/dmp-frontend/src/common/forms/form-service.ts index e0e4ce42b..2f518138b 100644 --- a/dmp-frontend/src/common/forms/form-service.ts +++ b/dmp-frontend/src/common/forms/form-service.ts @@ -68,15 +68,4 @@ export class FormService { public getValue(control: AbstractControl) { return JSON.parse(JSON.stringify(control)); //Used to deep copy formGroup. } - - // TODO - // public reapplyValidators(array: FormArray, validationContext: ValidationContext) { - // if (!Array.isArray(array.controls)) { return; } - // array.controls.forEach((element, index) => { - // const formGroup = element as FormGroup; - // Object.keys(formGroup.controls).forEach(key => { - // formGroup.get(key).setValidators(validationContext.getValidation(key).validators); - // }); - // }); - // } }