Skip to content

[Port to dtq-dev] add New version button for archived submission items#1278

Merged
milanmajchrak merged 3 commits into
dataquest-dev:dtq-devfrom
ufal:backport-130-to-dtq-dev
Jun 3, 2026
Merged

[Port to dtq-dev] add New version button for archived submission items#1278
milanmajchrak merged 3 commits into
dataquest-dev:dtq-devfrom
ufal:backport-130-to-dtq-dev

Conversation

@kosarko
Copy link
Copy Markdown

@kosarko kosarko commented Apr 27, 2026

Port of ufal#130 by @amadulhaxxani to dtq-dev.

* add New version action for archived submission items

 add New version action for archived submission items

* Use shareReplay to cache version draft observable

Import shareReplay and apply .pipe(shareReplay(1)) to the version draft observable in ItemActionsComponent. This shares the subscription and caches the latest emission so multiple subscribers won't trigger duplicate work or requests.

* Derive new-version tooltip from disable state

Use the disableNewVersion$ observable to compute newVersionTooltip$ (with map) and apply shareReplay to disableNewVersion$, instead of calling getVersioningTooltipMessage unconditionally. This avoids invoking the tooltip service when the button is disabled. Added map import and updated unit test to assert the tooltip is derived from the disabled state and that getVersioningTooltipMessage is not called.

(cherry picked from commit 3fb57f1)
Copy link
Copy Markdown

Copilot AI left a comment

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 “New version” action to the MyDSpace item actions UI, enabling authorized users to create a new version for (archived) items directly from the MyDSpace context.

Changes:

  • Introduces versioning authorization/state streams (canCreateVersion$, disableNewVersion$, newVersionTooltip$) and a click handler to open the existing versioning modal.
  • Updates the item actions template to conditionally render a “New version” button with disabled state + tooltip.
  • Extends unit tests to cover visibility/disabled state/tooltip derivation and modal opening behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/app/shared/mydspace-actions/item/item-actions.component.ts Adds versioning authorization checks, disabled/tooltip observables, and a method to open the create-version modal.
src/app/shared/mydspace-actions/item/item-actions.component.html Renders a conditional “New version” button with tooltip and aria-label bindings.
src/app/shared/mydspace-actions/item/item-actions.component.spec.ts Adds tests for the new button’s visibility/disabled state/tooltip logic and click behavior.

Comment thread src/app/shared/mydspace-actions/item/item-actions.component.ts
Comment thread src/app/shared/mydspace-actions/item/item-actions.component.ts
Comment thread src/app/shared/mydspace-actions/item/item-actions.component.spec.ts
Replace the inline mapping of disableNewVersion$ to compute the tooltip with dsoVersioningModalService.getVersioningTooltipMessage(this.object, 'item.page.version.hasDraft', 'item.page.version.create'), centralizing tooltip logic in the service. Also remove the now-unused rxjs 'map' import; shareReplay usage for disableNewVersion$ is preserved.
@milanmajchrak
Copy link
Copy Markdown
Collaborator

@amadulhaxxani The tests are failing. Would you have capacity to look into this, please?

@amadulhaxxani
Copy link
Copy Markdown

@milanmajchrak
strange, as I ran the tests and they were fine.
I am looking into it now.

@milanmajchrak milanmajchrak merged commit f46cb9c into dataquest-dev:dtq-dev Jun 3, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants