Skip to content

TK-28: Auto-fill Mandatory Fields from ISA When Creating Knowledge Item#39

Merged
klondikemarlen merged 56 commits intomainfrom
tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item
Mar 12, 2026
Merged

TK-28: Auto-fill Mandatory Fields from ISA When Creating Knowledge Item#39
klondikemarlen merged 56 commits intomainfrom
tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item

Conversation

@klondikemarlen
Copy link
Member

@klondikemarlen klondikemarlen commented Feb 20, 2026

Fixes https://yg-hpw.atlassian.net/browse/TK-28

Context

When creating a Knowledge Item, users must first attach it to an Information Sharing Agreement (ISA). The ISA should pre-fill the mandatory fields in the Knowledge Item form, reducing manual entry and ensuring data consistency.

This PR builds the Knowledge Item creation page accessible from the signed ISA view, consolidates ISA state-based actions into a reusable extended actions menu, and wires up the backend endpoint for creating archive items within ISA context.

Implementation

  1. Introduce a BaseActionsMenuBtnGroup component that combines a primary action button with a chevron-triggered overflow menu, shared across ISA states.
  2. Consolidate ISA draft and signed actions into the shared extended actions menu pattern.
  3. Add a Knowledge Item creation page linked from the signed ISA, with fields auto-populated from ISA context (title, description, security level, sharing purpose, Yukon First Nation).
  4. Add dedicated backend endpoint and service for creating archive items within ISA scope, including file uploads, category linking, and ISA junction record creation.
  5. Add archive item destroy service with full cleanup (files, categories, ISA links, audits).
  6. Upgrade Sequelize to 7.0.0-alpha.48 to support longer identifier names.
  7. Rework file storage service as an integration for reduced coupling.
  8. Add UI polish: mandatory field indicators, file input loading state, category chip close buttons, redirect after creation.

Screenshots

Linking Existing Knowledge Item to Unused Sharing Agreement
http://localhost:8080/archive-items/3003/information-sharing-agreements?showAddArchiveItemToInformationSharingAgreementDialog=3003
image

Knowledge Item linked to Sharing Agreement
http://localhost:8080/archive-items/3003/information-sharing-agreements
image

Sharing Agreement that does not have an existing Knowledge Item with create call-to-action
http://localhost:8080/information-sharing-agreements/1
image

Dedicated Knowledge Item creation page pre-filled from Sharing Agreement
http://localhost:8080/information-sharing-agreements/1/archive-items/new
image

Sharing Agreement with linked Knowledge Item
http://localhost:8080/information-sharing-agreements/1
image

Testing Instructions

  1. Run the test suite via dev test.
  2. Boot the app via dev up.
  3. Log in to the app at http://localhost:3000.

Test Case 1: Signed ISA actions menu shows correct options

  1. Click Sharing Agreements in the left sidebar nav.
  2. Open an ISA that is in Signed state.
  3. Verify the actions area shows an Edit button with a chevron dropdown to its right.
  4. Click the chevron dropdown button.
  5. Verify the menu contains:
    • Signed Acknowledgement (download option)
    • Revert to Draft (if you have update permission)
    • Create Knowledge Item
  6. Verify there is no View Knowledge Item option (since no knowledge item exists yet).

Test Case 2: Create Knowledge Item from signed ISA with pre-filled fields

  1. From the dropdown menu in Test Case 1, click Create Knowledge Item.
  2. Verify the page loads with breadcrumbs: HomeInformation Sharing AgreementsAgreement [ID]Create Knowledge Item from Agreement.
  3. Verify these fields are auto-populated from the ISA:
    • Title — matches the ISA title
    • Security level — mapped from ISA access level (INTERNAL → LOW, PROTECTED_AND_LIMITED → MEDIUM, CONFIDENTIAL_AND_RESTRICTED → HIGH)
    • Description — matches the ISA purpose
    • Sharing Purpose — matches the ISA authorized application
    • Yukon First Nation — shows the organization chip from the ISA's external sharing contact
  4. Verify the Confidentiality checkbox is unchecked and the form cannot be submitted without checking it.
  5. Select at least one Category from the dropdown.
  6. Optionally add Tags and Attachments.
  7. Check the I confirm that I have received and agreed to the confidentiality terms checkbox.
  8. Click Save.
  9. Verify a success message "Item created." appears.
  10. Verify you are redirected to the new Knowledge Item's ISA tab at /archive-items/:id/information-sharing-agreements.

Test Case 3: Create Knowledge Item button is hidden when one already exists

  1. Navigate back to Sharing Agreements in the left sidebar.
  2. Open the same signed ISA from Test Case 1.
  3. Click the chevron dropdown button.
  4. Verify Create Knowledge Item is no longer shown in the menu.
  5. Verify View Knowledge Item now appears instead.
  6. Click View Knowledge Item and verify it navigates to the Knowledge Item detail page.

Test Case 4: Draft ISA actions menu

  1. Navigate to Sharing Agreements in the left sidebar.
  2. Open an ISA that is in Draft state.
  3. Verify the actions area shows a primary button with a chevron dropdown.
  4. Click the chevron dropdown and verify the draft-specific actions are displayed (e.g., Sign option).
  5. Verify there is no Create Knowledge Item option on draft ISAs.

Test Case 5: Delete a Knowledge Item

  1. Navigate to Knowledge Items in the left sidebar.
  2. Open the Knowledge Item created in Test Case 2.
  3. Delete the Knowledge Item using the delete action.
  4. Verify a confirmation dialog appears.
  5. Confirm the deletion.
  6. Verify the item is removed from the Knowledge Items list.
  7. Navigate back to the signed ISA from Test Case 1.
  8. Click the chevron dropdown and verify Create Knowledge Item reappears (since the knowledge item was deleted).

TODO: need to add dedicated back-end endpoint for creation ArchiveItem from ISA namespace.
Groups of items should be plural to denote that they are a group rather than a singular thing.
TODO: Add files and categoryIds to archive item creation.
Should use standardized nesting patterns for nested resources.
i.e.
{ filesAttributes } (if "files" associations on model)
Pattern taken from Rails-verse.
Need to implement in back-end.
Why? Help reduce coupling and make it clear that this "integration" interacts with an external entity (Azure Blob Storage).
Why? So we can keep front- and back-end version in sync.
(and hopefully process "true" and "false" as booleans correctly)
Always return an object, since this reduces the number of null and type checks we need.
…e objects.

Now uses Lodash to do the same thing.
@klondikemarlen klondikemarlen force-pushed the tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item branch 2 times, most recently from 1471811 to 983b29b Compare February 27, 2026 18:20
Page level params will always be "string", but and then should be converted to "number".
Why? To hopefully let me use longer identifiers, so I don't have to rename a bunch of stuff.
informationSharingAgreementAccessGrants -> accessGrants.
Why? To fix this Sequelize query error:
The identifier that starts with 'informationSharingAgreementAccessGrants.ArchiveItemInformationSharingAgreementAccessGrant.informationSharingAgreementAccessGrant' is too long. Maximum length is 128.

I'm probably going to need to rename InformationSharingAgreement to SharingAgreement at some point.
@klondikemarlen klondikemarlen force-pushed the tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item branch from 983b29b to 9d0d441 Compare February 27, 2026 18:22
@klondikemarlen klondikemarlen force-pushed the tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item branch 2 times, most recently from 0cbad11 to 0ec777f Compare February 27, 2026 21:48
How? Instead of relying on complex cascading services, we now do everything directly.

This reduces complexity, at the cost of future code maybe going out of sync between services.
Instead log only when job is doing something.
@klondikemarlen klondikemarlen force-pushed the tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item branch from b8c04ac to bfc39c1 Compare March 12, 2026 15:24
@klondikemarlen klondikemarlen force-pushed the tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item branch from d47a027 to fe6af74 Compare March 12, 2026 17:04
Make primary button dynamic based on whether knowledge item exists.
Remove "edit" call-to-action now that you can no longer edit signed agreements.
"revert to draft" is still present in the extended actions menu.
@klondikemarlen klondikemarlen self-assigned this Mar 12, 2026
@klondikemarlen klondikemarlen added the enhancement New feature or request label Mar 12, 2026
@klondikemarlen klondikemarlen marked this pull request as ready for review March 12, 2026 20:05
@klondikemarlen klondikemarlen merged commit 61d5e07 into main Mar 12, 2026
1 check passed
@klondikemarlen klondikemarlen deleted the tk-28/auto-fill-mandatory-fields-from-isa-when-creating-knowledge-item branch March 12, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant