From e7951927df4edf4a0f3d071f005bca761bb7d11c Mon Sep 17 00:00:00 2001 From: cmoinier Date: Mon, 2 Dec 2024 12:48:00 +0100 Subject: [PATCH] feat: warning in toolbar --- .../top-toolbar/top-toolbar.component.html | 4 +++- .../top-toolbar/top-toolbar.component.ts | 3 ++- .../src/app/edit/edit-page.component.html | 21 +++++++++++++++++++ .../src/app/edit/edit-page.component.ts | 9 +++++++- .../records/my-draft/my-draft.component.html | 1 + 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html index 8257d3474..7145e8633 100644 --- a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html +++ b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html @@ -69,5 +69,7 @@ > --> - + diff --git a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts index afd16d683..32d3fc247 100644 --- a/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts +++ b/apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common' -import { ChangeDetectionStrategy, Component } from '@angular/core' +import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { MatDialog, MatDialogModule } from '@angular/material/dialog' import { MatTooltipModule } from '@angular/material/tooltip' import { EditorFacade } from '@geonetwork-ui/feature/editor' @@ -61,6 +61,7 @@ import { changeDetection: ChangeDetectionStrategy.OnPush, }) export class TopToolbarComponent { + @Input() publishWarning = [] protected SaveStatus = [ 'draft_only', // => when creating a record 'record_up_to_date', // => when the record was just published (ie saved on the server) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.html b/apps/metadata-editor/src/app/edit/edit-page.component.html index 7c41e5a78..fa5fe1eec 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.html +++ b/apps/metadata-editor/src/app/edit/edit-page.component.html @@ -4,13 +4,34 @@
+<<<<<<< HEAD
+======= + +
+>>>>>>> 4aeaddd7f (feat: warning in toolbar)
+
+
+ editor.record.form.draft.updateAlert +
+
currentPage >= pagesCount - 1) ) + hasRecordChanged$ = this.facade.hasRecordChanged$.pipe(skip(1)) @ViewChild('scrollContainer') scrollContainer: ElementRef @@ -161,6 +162,12 @@ export class EditPageComponent implements OnInit, OnDestroy { this.router.navigate(['edit', savedRecord.uniqueIdentifier]) }) ) + + this.subscription.add( + this.facade.record$.subscribe((record) => { + this.facade.hasRecordChangedSinceDraft(record) + }) + ) } ngOnDestroy() { diff --git a/apps/metadata-editor/src/app/records/my-draft/my-draft.component.html b/apps/metadata-editor/src/app/records/my-draft/my-draft.component.html index fdfb8f206..fc400041c 100644 --- a/apps/metadata-editor/src/app/records/my-draft/my-draft.component.html +++ b/apps/metadata-editor/src/app/records/my-draft/my-draft.component.html @@ -9,6 +9,7 @@

class="shadow-md shadow-gray-300 border-[1px] border-gray-200 overflow-hidden rounded bg-white grow mx-[32px] my-[16px] text-sm" >