kikocis/dataspace-portal public
Changesets · Branches · Tags · Compare
| Changeset | ed9211a4e64d11972aacce13d25d7f20f937cae3d67ae37c2b4bfc5d82cbaaf1 |
|---|---|
| Author | Kamil Czaja <46053356+kamilczaja@users.noreply.github.com> · 2024-07-22 16:29 +02:00 |
| Committer | GitHub <noreply@github.com> · 2024-07-22 16:29 +02:00 |
| Parents | 3e1282cf21a3 |
9 files changed
modified CHANGELOG.md +3 −0
| @@ -13,6 +13,9 @@ | ||
| 13 | 13 | |
| 14 | 14 | #### Minor |
| 15 | 15 | |
| 16 | +- Added unique URLs to data offers that enable direct navigation | |
| 17 | +- Added a button in the data offer detail view to copy the data offer URL | |
| 18 | + | |
| 16 | 19 | #### Patch |
| 17 | 20 | - Fix Catalog UI after Broker intergration [#238](https://github.com/sovity/authority-portal/issues/238) |
| 18 | 21 | - Fix deployment environment not syncing in URLs for the catalog |
modified authority-portal-frontend/src/app/app-routing.module.ts +20 −0
| @@ -149,6 +149,16 @@ | ||
| 149 | 149 | requiresRole: ['USER'] satisfies UserRoleDto[], |
| 150 | 150 | }, |
| 151 | 151 | canActivate: [requiresRole], |
| 152 | + children: [ | |
| 153 | + { | |
| 154 | + path: ':connectorId/:assetId', | |
| 155 | + component: CatalogPageComponent, | |
| 156 | + data: { | |
| 157 | + requiresRole: ['USER'] satisfies UserRoleDto[], | |
| 158 | + }, | |
| 159 | + canActivate: [requiresRole], | |
| 160 | + }, | |
| 161 | + ], | |
| 152 | 162 | }, |
| 153 | 163 | { |
| 154 | 164 | path: 'my-organization/data-offers', |
| @@ -158,6 +168,16 @@ | ||
| 158 | 168 | catalogType: 'my-data-offers', |
| 159 | 169 | }, |
| 160 | 170 | canActivate: [requiresRole], |
| 171 | + children: [ | |
| 172 | + { | |
| 173 | + path: ':connectorId/:assetId', | |
| 174 | + component: CatalogPageComponent, | |
| 175 | + data: { | |
| 176 | + requiresRole: ['USER'] satisfies UserRoleDto[], | |
| 177 | + }, | |
| 178 | + canActivate: [requiresRole], | |
| 179 | + }, | |
| 180 | + ], | |
| 161 | 181 | }, |
| 162 | 182 | { |
| 163 | 183 | path: 'control-center', |
modified authority-portal-frontend/src/app/pages/catalog-page/asset-detail-dialog/asset-detail-dialog.component.html +20 −17
| @@ -1,24 +1,27 @@ | ||
| 1 | 1 | <div class="p-2"> |
| 2 | - <!-- close button --> | |
| 3 | - <div class="flex w-full justify-end"> | |
| 4 | - <button class="!fixed" mat-icon-button mat-dialog-close aria-label="close"> | |
| 5 | - <mat-icon>close</mat-icon> | |
| 6 | - </button> | |
| 7 | - </div> | |
| 8 | - <!-- close button --> | |
| 9 | - | |
| 10 | 2 | <!-- Title Section --> |
| 11 | - <div class="flex flex-col justify-start mt-4 mx-4 lg:mx-8 lg:mt-[3rem]"> | |
| 12 | - <h3 class="form-dialog-title"> | |
| 13 | - {{ dataOffer.assetTitle }} | |
| 3 | + <div class="flex flex-row justify-between"> | |
| 4 | + <div class="flex flex-col justify-start mt-4 mx-4 lg:mx-8 lg:mt-[3rem]"> | |
| 5 | + <h3 class="form-dialog-title"> | |
| 6 | + {{ dataOffer.assetTitle }} | |
| 14 | 7 | |
| 15 | - <app-connector-status-led | |
| 16 | - class="inline-flex" | |
| 17 | - [status]="dataOffer.connectorOnlineStatus"> | |
| 18 | - </app-connector-status-led> | |
| 19 | - </h3> | |
| 20 | - <p class="form-dialog-prose">{{ dataOffer.organizationName }}</p> | |
| 8 | + <app-connector-status-led | |
| 9 | + class="inline-flex" | |
| 10 | + [status]="dataOffer.connectorOnlineStatus"> | |
| 11 | + </app-connector-status-led> | |
| 12 | + </h3> | |
| 13 | + <p class="form-dialog-prose">{{ dataOffer.organizationName }}</p> | |
| 14 | + </div> | |
| 15 | + <div class="flex flex-row justify-start mt-4 mx-4 lg:mx-8 lg:mt-[2.5rem]"> | |
| 16 | + <button mat-icon-button (click)="copyUrl()"> | |
| 17 | + <mat-icon>share</mat-icon> | |
| 18 | + </button> | |
| 19 | + <button mat-icon-button mat-dialog-close aria-label="close"> | |
| 20 | + <mat-icon>close</mat-icon> | |
| 21 | + </button> | |
| 22 | + </div> | |
| 21 | 23 | </div> |
| 24 | + | |
| 22 | 25 | <!-- Title Section --> |
| 23 | 26 | |
| 24 | 27 | <!-- Content Section --> |
modified authority-portal-frontend/src/app/pages/catalog-page/asset-detail-dialog/asset-detail-dialog.component.ts +15 −0
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | DataOfferDetailPageResult, |
| 19 | 19 | UiAsset, |
| 20 | 20 | } from '@sovity.de/authority-portal-client'; |
| 21 | +import {ToastService} from '../../../shared/common/toast-notifications/toast.service'; | |
| 21 | 22 | import {PropertyGridGroup} from '../property-grid-group/property-grid-group'; |
| 22 | 23 | import {AssetDetailDialogData} from './asset-detail-dialog-data'; |
| 23 | 24 | |
| @@ -44,6 +45,7 @@ | ||
| 44 | 45 | constructor( |
| 45 | 46 | @Inject(MAT_DIALOG_DATA) |
| 46 | 47 | private _data: AssetDetailDialogData | Observable<AssetDetailDialogData>, |
| 48 | + private toastService: ToastService, | |
| 47 | 49 | ) { |
| 48 | 50 | if (isObservable(this._data)) { |
| 49 | 51 | this._data |
| @@ -61,6 +63,19 @@ | ||
| 61 | 63 | this.propGroups = this.data.propertyGridGroups; |
| 62 | 64 | } |
| 63 | 65 | |
| 66 | + copyUrl() { | |
| 67 | + navigator.clipboard | |
| 68 | + .writeText(window.location.href) | |
| 69 | + .then(() => { | |
| 70 | + this.toastService.showSuccess('Data Offer URL copied to clipboard'); | |
| 71 | + }) | |
| 72 | + .catch(() => { | |
| 73 | + this.toastService.showSuccess( | |
| 74 | + 'Failed to copy Data Offer URL to clipboard. Check if your browser permissions allow this action.', | |
| 75 | + ); | |
| 76 | + }); | |
| 77 | + } | |
| 78 | + | |
| 64 | 79 | ngOnDestroy$ = new Subject(); |
| 65 | 80 | |
| 66 | 81 | ngOnDestroy(): void { |
modified authority-portal-frontend/src/app/pages/catalog-page/asset-detail-dialog/asset-detail-dialog.service.ts +16 −2
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | import {Injectable} from '@angular/core'; |
| 14 | 14 | import {MatDialog} from '@angular/material/dialog'; |
| 15 | 15 | import {NEVER, Observable, takeUntil} from 'rxjs'; |
| 16 | -import {map, switchMap} from 'rxjs/operators'; | |
| 16 | +import {catchError, map, switchMap} from 'rxjs/operators'; | |
| 17 | 17 | import {DataOfferDetailPageQuery} from '@sovity.de/authority-portal-client'; |
| 18 | 18 | import {CatalogApiService} from 'src/app/core/api/catalog-api.service'; |
| 19 | 19 | import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils'; |
| @@ -22,6 +22,7 @@ | ||
| 22 | 22 | import {AssetDetailDialogData} from './asset-detail-dialog-data'; |
| 23 | 23 | import {AssetDetailDialogDataService} from './asset-detail-dialog-data.service'; |
| 24 | 24 | import {AssetDetailDialogComponent} from './asset-detail-dialog.component'; |
| 25 | +import {AssetNotAvailableDialogComponent} from './asset-not-available-dialog/asset-not-available-dialog.component'; | |
| 25 | 26 | |
| 26 | 27 | @Injectable() |
| 27 | 28 | export class AssetDetailDialogService { |
| @@ -53,8 +54,10 @@ | ||
| 53 | 54 | map((result) => |
| 54 | 55 | this.assetDetailDialogDataService.dataOfferDetailPage(result), |
| 55 | 56 | ), |
| 56 | - this.errorService.toastFailureRxjs('Failed to load Data Offer Details'), | |
| 57 | 57 | switchMap((data) => this.openDialogWithData(data, until$)), |
| 58 | + catchError(() => { | |
| 59 | + return this.openErrorDialog(until$); | |
| 60 | + }), | |
| 58 | 61 | ); |
| 59 | 62 | } |
| 60 | 63 | |
| @@ -79,4 +82,15 @@ | ||
| 79 | 82 | until$, |
| 80 | 83 | ); |
| 81 | 84 | } |
| 85 | + | |
| 86 | + private openErrorDialog( | |
| 87 | + until$: Observable<any> = NEVER, | |
| 88 | + ): Observable<undefined> { | |
| 89 | + return showDialogUntil( | |
| 90 | + this.dialog, | |
| 91 | + AssetNotAvailableDialogComponent, | |
| 92 | + {maxWidth: '600px'}, | |
| 93 | + until$, | |
| 94 | + ); | |
| 95 | + } | |
| 82 | 96 | } |
added authority-portal-frontend/src/app/pages/catalog-page/asset-detail-dialog/asset-not-available-dialog/asset-not-available-dialog.component.html +16 −0
| @@ -0,0 +1,16 @@ | ||
| 1 | +<div class="flex flex-row"> | |
| 2 | + <div class="flex flex-col justify-start items-start p-6"> | |
| 3 | + <h3 class="text-xl font-bold mb-6 mt-3">Data Offer not found</h3> | |
| 4 | + <p> | |
| 5 | + We could not find the data offer you are looking for. The URL you provided | |
| 6 | + is incorrect or the data offer is no longer available. | |
| 7 | + </p> | |
| 8 | + <button | |
| 9 | + class="btn-accent-outline mt-6 ml-auto" | |
| 10 | + type="button" | |
| 11 | + mat-dialog-close | |
| 12 | + (click)="closeDialog()"> | |
| 13 | + Close | |
| 14 | + </button> | |
| 15 | + </div> | |
| 16 | +</div> |
added authority-portal-frontend/src/app/pages/catalog-page/asset-detail-dialog/asset-not-available-dialog/asset-not-available-dialog.component.ts +24 −0
| @@ -0,0 +1,24 @@ | ||
| 1 | +import {Component, OnDestroy} from '@angular/core'; | |
| 2 | +import {MatDialogRef} from '@angular/material/dialog'; | |
| 3 | +import {Subject} from 'rxjs'; | |
| 4 | + | |
| 5 | +@Component({ | |
| 6 | + selector: 'app-asset-not-available-dialog', | |
| 7 | + templateUrl: './asset-not-available-dialog.component.html', | |
| 8 | +}) | |
| 9 | +export class AssetNotAvailableDialogComponent implements OnDestroy { | |
| 10 | + constructor( | |
| 11 | + private dialogRef: MatDialogRef<AssetNotAvailableDialogComponent>, | |
| 12 | + ) {} | |
| 13 | + | |
| 14 | + closeDialog(): void { | |
| 15 | + this.dialogRef.close(); | |
| 16 | + } | |
| 17 | + | |
| 18 | + ngOnDestroy$ = new Subject(); | |
| 19 | + | |
| 20 | + ngOnDestroy(): void { | |
| 21 | + this.ngOnDestroy$.next(null); | |
| 22 | + this.ngOnDestroy$.complete(); | |
| 23 | + } | |
| 24 | +} |
modified authority-portal-frontend/src/app/pages/catalog-page/catalog-page/catalog-page.component.ts +43 −3
| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | } from '@angular/core'; |
| 20 | 20 | import {FormControl} from '@angular/forms'; |
| 21 | 21 | import {PageEvent} from '@angular/material/paginator'; |
| 22 | -import {ActivatedRoute, Params} from '@angular/router'; | |
| 22 | +import {ActivatedRoute, Router} from '@angular/router'; | |
| 23 | 23 | import {Subject, distinctUntilChanged, of, switchMap, tap} from 'rxjs'; |
| 24 | -import {map, take, takeUntil} from 'rxjs/operators'; | |
| 24 | +import {finalize, map, take, takeUntil} from 'rxjs/operators'; | |
| 25 | 25 | import {Store} from '@ngxs/store'; |
| 26 | 26 | import { |
| 27 | 27 | CatalogDataOffer, |
| @@ -69,6 +69,7 @@ | ||
| 69 | 69 | private assetDetailDialogService: AssetDetailDialogService, |
| 70 | 70 | private store: Store, |
| 71 | 71 | private route: ActivatedRoute, |
| 72 | + private router: Router, | |
| 72 | 73 | private globalStateUtils: GlobalStateUtils, |
| 73 | 74 | private deploymentEnvironmentUrlSyncService: DeploymentEnvironmentUrlSyncService, |
| 74 | 75 | ) {} |
| @@ -87,6 +88,7 @@ | ||
| 87 | 88 | this.startListeningToEnvironmentChanges(); |
| 88 | 89 | this.startEmittingSearchText(); |
| 89 | 90 | this.startEmittingSortBy(); |
| 91 | + this.openDataOfferDetailDialogOnceFromUrl(); | |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | 94 | private initializePage() { |
| @@ -115,6 +117,14 @@ | ||
| 115 | 117 | }); |
| 116 | 118 | } |
| 117 | 119 | |
| 120 | + private openDataOfferDetailDialogOnceFromUrl() { | |
| 121 | + const params = this.route.firstChild?.snapshot.params; | |
| 122 | + if (params) { | |
| 123 | + console.log('PARAMS ' + params['connectorId'] + ' ' + params['assetId']); | |
| 124 | + this.openDataOfferDialog(params['assetId'], params['connectorId']); | |
| 125 | + } | |
| 126 | + } | |
| 127 | + | |
| 118 | 128 | private startListeningToStore() { |
| 119 | 129 | this.store |
| 120 | 130 | .select<CatalogPageStateModel>(CatalogPageState) |
| @@ -155,9 +165,39 @@ | ||
| 155 | 165 | } |
| 156 | 166 | |
| 157 | 167 | onDataOfferClick(dataOffer: CatalogDataOffer) { |
| 168 | + this.openDataOfferDialog(dataOffer.assetId, dataOffer.connectorId); | |
| 169 | + } | |
| 170 | + | |
| 171 | + private openDataOfferDialog(assetId: string, connectorId: string) { | |
| 158 | 172 | this.assetDetailDialogService |
| 159 | - .open(dataOffer.assetId, dataOffer.connectorId, this.ngOnDestroy$) | |
| 173 | + .open(assetId, connectorId, this.ngOnDestroy$) | |
| 174 | + .pipe( | |
| 175 | + finalize(() => { | |
| 176 | + this.changeUrlToCatalogRoot(); | |
| 177 | + }), | |
| 178 | + ) | |
| 160 | 179 | .subscribe(); |
| 180 | + | |
| 181 | + this.router.navigate([connectorId, assetId], { | |
| 182 | + relativeTo: this.route, | |
| 183 | + queryParams: { | |
| 184 | + environmentId: this.route.snapshot.queryParams.environmentId, | |
| 185 | + }, | |
| 186 | + }); | |
| 187 | + // BreadcrumbService builds the name from the URL which is nonsensical in casse of asset IDs | |
| 188 | + document.title = 'MDS Catalog - Data Offer'; | |
| 189 | + } | |
| 190 | + | |
| 191 | + private changeUrlToCatalogRoot() { | |
| 192 | + const currentRoute = this.route.snapshot; | |
| 193 | + this.router.navigate( | |
| 194 | + [currentRoute.url.map((segment) => segment.path).join('/')], | |
| 195 | + { | |
| 196 | + queryParams: { | |
| 197 | + environmentId: currentRoute.queryParams.environmentId, | |
| 198 | + }, | |
| 199 | + }, | |
| 200 | + ); | |
| 161 | 201 | } |
| 162 | 202 | |
| 163 | 203 | ngOnDestroy$ = new Subject(); |
modified authority-portal-frontend/src/app/shared/common/toast-notifications/toast-notifications.component.html +1 −1
| @@ -1,4 +1,4 @@ | ||
| 1 | -<div class="flex flex-col fixed items-end right-3 top-3 space-y-2 z-50"> | |
| 1 | +<div class="flex flex-col fixed items-end right-3 top-3 space-y-2 z-[9999]"> | |
| 2 | 2 | <div |
| 3 | 3 | *ngFor="let toast of toasts; trackBy: trackByFn" |
| 4 | 4 | class="flex flex-row items-center bg-white rounded-lg shadow-lg overflow-hidden p-2 max-h-12 border w-fit animate-showNotification" |