Skip to content

[PER-10415] Edtf date record viewer - #1065

Open
aasandei-vsp wants to merge 4 commits into
PER-10643-edtf-validationfrom
PER-10415-edtf-date-record-viewer
Open

[PER-10415] Edtf date record viewer#1065
aasandei-vsp wants to merge 4 commits into
PER-10643-edtf-validationfrom
PER-10415-edtf-date-record-viewer

Conversation

@aasandei-vsp

@aasandei-vsp aasandei-vsp commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Manual test cases — EDTF date in the full-screen record view

Setup: log in with the edtf-date feature flag on, upload a file, click it to open the full-screen record view. The metadata panel now shows a Date picker above the metadata table (the old Date row inside the table is gone).

Warning

This PR also changes the inline picker's commit behavior everywhere it appears (file-list sidebar and the full-screen view): it no longer lets you attempt an invalid save and surface the error as a toast. It now shows a general error message inside the picker and disables Save, same gating as the modal. The "run in both places" tests from the PER-10643 test plan should be re-run with the new expectation below.

Note

Field-specific messages (invalid characters, out-of-range month/day, day-for-month) still appear inline below the offending input. What's new is the picker-level line above the footer: the generic The date entered is not valid. Please check the values and try again. for anything with an inline message, and A complete date is required when time is provided. keeps its specific text (it has no inline field to attach to).


Feature flag & placement

Flag on

  1. Open a record full-screen.
    • EXPECTED: The EDTF date picker renders above the metadata table. There is no Date row inside the metadata table.

Flag off

  1. Turn the edtf-date flag off and open a record full-screen.
    • EXPECTED: The old behavior: Date row inside the metadata table with the legacy inline edit, no EDTF picker.

General error & Save gating in the inline picker ⭐

(run in both the file-list sidebar picker and the full-screen view picker — same component, both surfaces must gate)

Invalid field value disables Save and shows the general error

  1. Open the inline picker and enter month 13 (or day 32).
    • EXPECTED: The field shows its specific message inline, and a red general error appears above the footer: The date entered is not valid. Please check the values and try again. The Save button is disabled (greyed out, not-allowed cursor).
  2. Click Save anyway / press Enter.
    • EXPECTED: Nothing happens — no save request, no toast, the dropdown stays open.
  3. Correct the value.
    • EXPECTED: The general error disappears and Save becomes enabled.

Impossible calendar day

  1. Enter year 2021, month 02, day 29.
    • EXPECTED: That day does not exist in the selected month and year. inline below the day input, the generic error above the footer, Save disabled.

Time without a complete date

  1. Enter a time (e.g. 02:30 PM) with the date fields empty or partial.
    • EXPECTED: The picker error shows the specific text A complete date is required when time is provided. (no inline field message for this one). Save is disabled; clicking it does nothing and the dropdown stays open.

Valid value

  1. Enter a complete valid date.
    • EXPECTED: No error line, Save enabled, save works as before.

Saving from the full-screen view

Inline picker save

  1. In the full-screen view, open the picker, enter 1985 / 05 / 20, Save.
    • EXPECTED: The picker closes and displays 1985-05-20. No error toast.
  2. Close the full-screen view and check the file list / sidebar, then reload the page and reopen the record.
    • EXPECTED: The value persists everywhere.

More options modal

  1. Enter a partial value inline (e.g. year 1990), then click More options.
    • EXPECTED: The modal opens prefilled with what you typed inline.
  2. Add a qualifier or a range in the modal and Save.
    • EXPECTED: The full-screen picker displays the saved value; it persists after reload.
  3. Reopen the modal, add a different qualifier or range and Cancel.
    • EXPECTED: No change is saved; the stored value is untouched.

Record without a date (displayDT fallback)

  1. Open a freshly uploaded record that has never had a date set.
    • EXPECTED: The Date section in the sidebar does not show a date, but the message "Click to add date"

Clearing the date

  1. On a record with a saved date, open the picker, clear every field, Save.
    • EXPECTED: Save succeeds. The picker shows no date.
  2. Reload and reopen the record.
    • EXPECTED: The date stays cleared — it does not fall back to any other date value.

Failed save re-syncs the picker

  1. On a record with date 2000-01-01, go offline (DevTools → Network → Offline) or block the update request, then save 2010-06-15 from the inline picker.
    • EXPECTED: An error banner appears and is fully visible on top of the full-screen view (it used to render behind it). The picker re-syncs back to 2000-01-01 instead of keeping the unsaved 2010-06-15.
  2. Repeat via the More options modal.
    • EXPECTED: Same — banner visible, picker shows the stored value after the failure.
  3. Go back online and save again.
    • EXPECTED: Works normally.

Permissions

Viewer access

  1. Open a record shared with you with Viewer access (below Editor) full-screen.
    • EXPECTED: The date section is visible but disabled — it cannot be opened/edited.

Unlisted share link

  1. Open a record via an unlisted share link.
    • EXPECTED: Picker disabled.

Public archive

  1. Open a record in a public archive view.
    • EXPECTED: Picker disabled.

Navigating between records in the viewer

  1. With several files in a folder (different dates, including one with no date), open one full-screen and use the arrow keys / swipe to move to the next and previous records.
    • EXPECTED: The picker updates to each record's own date on every navigation — no stale value carried over from the previous record.

@aasandei-vsp aasandei-vsp self-assigned this Jun 17, 2026
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.63%. Comparing base (80e59ec) to head (842cc6d).

Files with missing lines Patch % Lines
...er/components/file-viewer/file-viewer.component.ts 78.12% 7 Missing ⚠️
...debar-date-picker/sidebar-date-picker.component.ts 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           PER-10643-edtf-validation    #1065      +/-   ##
=============================================================
- Coverage                      52.64%   52.63%   -0.02%     
=============================================================
  Files                            354      354              
  Lines                          12199    12236      +37     
  Branches                        2220     2227       +7     
=============================================================
+ Hits                            6422     6440      +18     
- Misses                          5549     5566      +17     
- Partials                         228      230       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aasandei-vsp
aasandei-vsp force-pushed the PER-10643-edtf-validation branch from fe7dd07 to 57c3de4 Compare June 29, 2026 10:27
@aasandei-vsp
aasandei-vsp force-pushed the PER-10415-edtf-date-record-viewer branch from 67e2e7f to dd1b3c1 Compare June 29, 2026 10:55
@cecilia-donnelly

Copy link
Copy Markdown
Member

+1 to @slifty 's comments and I'll remove myself as a reviewer for now.

@cecilia-donnelly
cecilia-donnelly removed their request for review July 10, 2026 15:30
@aasandei-vsp
aasandei-vsp force-pushed the PER-10643-edtf-validation branch from 57c3de4 to 67edbff Compare July 14, 2026 12:45
@aasandei-vsp

Copy link
Copy Markdown
Contributor Author

+1 to @slifty 's comments and I'll remove myself as a reviewer for now.

Very good points, I've addressed all of them.

@aasandei-vsp
aasandei-vsp force-pushed the PER-10415-edtf-date-record-viewer branch from dd1b3c1 to df091d0 Compare July 15, 2026 10:24
@aasandei-vsp
aasandei-vsp force-pushed the PER-10643-edtf-validation branch 4 times, most recently from 5381112 to 6458a27 Compare July 27, 2026 12:11
@slifty

slifty commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@aasandei-vsp I'm back from vacation -- I imagine we'll catch up on standup shortly about the status of this PR / if you're looking for another review!

@cecilia-donnelly

Copy link
Copy Markdown
Member

@slifty, I've been working with @aasandei-vsp on #1056, which I've just approved. This one probably needs conflicts updated because of our work over there, and then yes I expect it is ready for another round of review. Correct me if I'm wrong about any of that, @aasandei-vsp !

@aasandei-vsp
aasandei-vsp force-pushed the PER-10643-edtf-validation branch from 6458a27 to 80e59ec Compare July 28, 2026 09:58
Gate the date control on the edtf-date flag: show the EDTF dropdown/modal
when it's on, and the legacy inline date field when it's off.

Port the sidebar's date handling to the file viewer:
- Cache displayTimeObject in a field, recomputed per record in initRecord,
  instead of a getter that allocated on every change-detection cycle.
- Re-sync after every save via a shared saveDisplayTime helper (used by
  both the inline picker and the modal), including on failure.
- Track the modal's closed subscription so it unsubscribes on destroy.

Issue: PER-10415
The global error banner sat at a lower z-index than full-screen views
(e.g. the file viewer), so errors rendered but were hidden behind the
overlay. Raise it above the full-screen layer and the date/time picker
dropdowns that open within it.

Issue: PER-10415
Mirror the sidebar behavior: persist null instead of '' when a date is
cleared, and render an explicitly-null displayTime as empty ("Click to
add date"). Add specs.

Issue: PER-10643
@aasandei-vsp
aasandei-vsp force-pushed the PER-10415-edtf-date-record-viewer branch from df091d0 to f497b06 Compare July 28, 2026 10:15
@aasandei-vsp

Copy link
Copy Markdown
Contributor Author

@cecilia-donnelly You are exactly right about the situation :D
@slifty I have rebased this and it's now ready for review again. On top of the manual test cases mentioned in the comment of this PR, it's worth to maybe have a look at the tests from the EDTF epic as well.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a feature-flagged EDTF date editor to the full-screen file viewer, aligning the viewer’s Date UI with the newer EDTF-based sidebar/editor flow while preserving the legacy inline Date editor when the flag is off.

Changes:

  • Introduces the EDTF date picker into the full-screen file viewer behind the edtf-date feature flag, hiding the legacy Date row when enabled.
  • Adds EDTF validation UX to the sidebar date picker (disable Save + show inline error message when the current model can’t be serialized to EDTF).
  • Refactors shared EDTF error styling into a reusable SCSS mixin and raises the message banner z-index to ensure errors remain visible above overlays/dropdowns.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/styles/_mixins.scss Adds a shared edtf-error-message mixin for consistent EDTF validation error styling.
src/app/shared/components/message/message.component.scss Raises banner z-index so error messages aren’t hidden behind full-screen viewer/dropdowns.
src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.ts Adds computed EDTF validation state, blocks Save when invalid, and centralizes DateTimeModel construction.
src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.spec.ts Adds unit tests covering invalid/valid EDTF validation behavior and Save blocking.
src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.scss Styles inline EDTF validation error and disabled Save button state.
src/app/file-browser/components/sidebar-date-picker/sidebar-date-picker.component.html Renders validation error message and disables Save button when invalid.
src/app/file-browser/components/file-viewer/file-viewer.component.ts Adds feature-flagged EDTF viewer integration, parsing/serialization, and modal “More options” handling.
src/app/file-browser/components/file-viewer/file-viewer.component.spec.ts Adds tests for flag gating and EDTF parsing/saving/resync behavior.
src/app/file-browser/components/file-viewer/file-viewer.component.html Conditionally renders EDTF picker vs. legacy Date row based on feature flag.
src/app/file-browser/components/edit-date-time-modal/edit-date-time-modal.component.scss Switches modal EDTF error styling to the shared mixin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/file-browser/components/file-viewer/file-viewer.component.ts Outdated

@slifty slifty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot made a var name suggestion I agree with -- approving so you don't get blocked on needing another review after that though, looks good!

- Give the inline date picker the same live EDTF validation as the
  modal: save is disabled with an inline error while the input is
  invalid, sharing the modal's error styling via a new mixin.
- Skip the date recompute in the file viewer when the edtf-date flag
  is off, so no EDTF errors can surface while the picker is hidden.
- Await the property save in the file viewer so the picker re-syncs
  to the reverted value when a save fails on the server.

Issue: PER-10415
@aasandei-vsp
aasandei-vsp force-pushed the PER-10415-edtf-date-record-viewer branch from f497b06 to 842cc6d Compare August 3, 2026 08:39
@aasandei-vsp

Copy link
Copy Markdown
Contributor Author

Copilot made a var name suggestion I agree with -- approving so you don't get blocked on needing another review after that though, looks good!

@slifty That is indeed much better, fixed! Thank you!

@aasandei-vsp aasandei-vsp added the QA This issue is ready for QA / user acceptance testing label Aug 3, 2026
@cecilia-donnelly
cecilia-donnelly removed their request for review August 3, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

QA This issue is ready for QA / user acceptance testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants