Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCK-1195: Add archived entry UI #1852

Merged
merged 30 commits into from
Oct 30, 2023
Merged

Conversation

svonworl
Copy link
Contributor

@svonworl svonworl commented Oct 19, 2023

Description
This PR modifies the UI to accommodate archived entries, which are intended to be read-only and deemphasized in the UI. We imagine that users will archive old/retired/obsolete entries that they aren't allowed to delete. To that end, this PR:

  • Adds "Archive"/"Unarchive" buttons to the "actions" buttons that appear to the upper right on the entry screen.
  • Gates the "Archive" button with a dialog that explains what happens when the entry is archived.
  • Marks archived entries as "Archived".
  • Disables/hides UI elements that could be used to modify an archived entry.
  • Adds a new "Archived" column to the "my entries" sidebar accordion, which appears as necessary to list archived entries.
  • Sorts the Search results so that archived entries always appear last, and adds a collapsed "Archived" facet.

See below for a screenshot.

In retrospect, this should have been split into at least two PRs, but by the time I realized so, it was too late.

Editorial: this PR reminded me of how very difficult it can be to correctly make substantial changes to the current UI. There's many contributing factors: the relative heaviness of Angular, the tool/workflow split, extensive Observable manipulation, state scattered everywhere, race conditions, lack of documentation, duplicate+ low-level code/HTML, etc. In many systems, relative to the backend, it's much easier to experiment with and iterate the UI, but not here. In the longer term, it'd probably benefit us to consider how to improve the situation. Retire the old-style tool concept? Simplify the UI to simplify the code? Refactor (to varying degrees)? UI3? IMHO, all of those options should be on the table...

In that vein, there are numerous slight inconsistencies between how the new archive UI appears/works for workflows/notebooks/apptools versus old-style tools, much like the existing UI. :)

Screenshots
The gate dialog:
image

The "my" page an archived workflow:
image

Review Instructions
Register and publish an entry on qa, then navigate to the entry page and archive it. Confirm that when the entry is archived, the entry is marked "Archived", the UI becomes read-only, the entry appears in the "Archived" section of your entry sidebar, and that the entry appears last in the appropriate Search results. Unarchive the entry and confirm that all of these changes have been reversed.

Issue
https://ucsc-cgl.atlassian.net/browse/DOCK-1195
dockstore/dockstore#3199

Security
If there are any concerns that require extra attention from the security team, highlight them here.

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Check that your code compiles by running npm run build
  • Ensure that the PR targets the correct branch. Check the milestone or fix version of the ticket.
  • If this is the first time you're submitting a PR or even if you just need a refresher, consider reviewing our style guide
  • Do not bypass Angular sanitization (bypassSecurityTrustHtml, etc.), or justify why you need to do so
  • If displaying markdown, use the markdown-wrapper component, which does extra sanitization
  • Do not use cookies, although this may change in the future
  • Run npm audit and ensure you are not introducing new vulnerabilities
  • Do due diligence on new 3rd party libraries, checking for CVEs
  • Don't allow user-uploaded images to be served from the Dockstore domain
  • If this PR is for a user-facing feature, create and link a documentation ticket for this feature (usually in the same milestone as the linked issue). Style points if you create a documentation PR directly and link that instead.
  • Check whether this PR disables tests. If it legitimately needs to disable a test, create a new ticket to re-enable it in a specific milestone.

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Attention: 53 lines in your changes are missing coverage. Please review.

Comparison is base (ca76a6b) 40.53% compared to head (c335627) 40.47%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1852      +/-   ##
===========================================
- Coverage    40.53%   40.47%   -0.06%     
===========================================
  Files          365      366       +1     
  Lines        11283    11359      +76     
  Branches      2896     2913      +17     
===========================================
+ Hits          4574     4598      +24     
- Misses        4407     4449      +42     
- Partials      2302     2312      +10     
Files Coverage Δ
...ner/tool-file-editor/tool-file-editor.component.ts 30.76% <ø> (ø)
...try/delete/dialog/delete-entry-dialog.component.ts 38.88% <ø> (ø)
...p/myworkflows/my-workflow/my-workflow.component.ts 72.72% <100.00%> (+0.35%) ⬆️
src/app/myworkflows/myworkflows.service.ts 31.88% <100.00%> (ø)
src/app/search/map-friendly-values.pipe.ts 72.22% <ø> (ø)
src/app/search/state/search.service.ts 21.20% <ø> (ø)
...shared/entry-actions/workflow-actions.component.ts 15.15% <100.00%> (-0.98%) ⬇️
src/app/test/mocked-objects.ts 100.00% <100.00%> (ø)
src/app/test/service-stubs.ts 58.46% <ø> (ø)
src/app/shared/my-entry.ts 70.73% <0.00%> (ø)
... and 6 more

... and 1 file with indirect coverage changes

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

@coverbeck
Copy link
Contributor

In your PR description, the link to the GitHub issue is missing dockstore/dockstore (I've made the same mistake many times :) ).

src/app/shared/entry-actions/entry-actions.service.ts Outdated Show resolved Hide resolved

constructor(
public dialogRef: MatDialogRef<ArchiveEntryDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: { entry: Entry; callback: (archived: Entry) => void },
Copy link
Contributor

Choose a reason for hiding this comment

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

Despite our attempts with the OpenAPI hierarchy, DockstoreTool and Workflow unfortunately do not extend Entry. If they did extend Entry, this would be the right way.

Since they don't, I'd suggest making this entry: Workflow | DockstoreTool.

Rationale: if we ever introduce a new Entry that doesn't extend DockstoreTool or Workflow, unlikely though that may be, we would get a compilation error, which we would want, because line 46 would fail at runtime.

That said, you have to go through hoops to enforce type checking with MAT_DIALOG_DATA, which we don't do, so I guess optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get your drift, the two approaches have different pros and cons, for sure. Yes, Workflow and DockstoreTool don't formally derive to Entry right now, but we know they are derivatives. The choice to use Entry was intentional on my part, so it's best IMHO, but you're the lead, so feel free to override... :)

As a compromise, I added some code to line 46 that uses the Entry.gitUrl as a fallback, so for a radically-different type of new entry, it's more likely to display something moderately useful, at least...

Copy link
Contributor

@kathy-t kathy-t left a comment

Choose a reason for hiding this comment

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

This feature could use a documentation ticket

title="{{ toolObj?.name + (toolObj?.toolname ? '/' + toolObj?.toolname : '') }}"
[routerLink]="'/my-tools/' + toolObj.tool_path"
>
{{ toolObj?.name + (toolObj?.toolname ? '/' + toolObj?.toolname : '') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

The de-duplication is great 😀 if you want to take it one step further, I found this pipe today that does what this line and a couple line above does

export class EntryToDisplayNamePipe implements PipeTransform {

title="{{ workflowObj?.repository + (workflowObj?.workflowName ? '/' + workflowObj?.workflowName : '') }}"
[routerLink]="'/my-' + (entryType$ | async) + 's/' + workflowObj.full_workflow_path"
>
{{ workflowObj?.repository + (workflowObj?.workflowName ? '/' + workflowObj?.workflowName : '') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto about the pipe

export class EntryToDisplayNamePipe implements PipeTransform {

src/app/workflow/workflow.component.html Outdated Show resolved Hide resolved
@svonworl
Copy link
Contributor Author

svonworl commented Oct 20, 2023

I addressed the feedback, the most visible changes are edits to the dialog text, and the addition of a yellow banner above an archived entry (the message text is pretty much the same as github's, it says the two important things). The text in the banner is left-aligned because given the location of the prominent items on the entry page, there's probably more of a chance that the user will read it. The date format is one of the several we use...

I've re-requested review.

Screenshots below:
image

image

@svonworl svonworl requested review from kathy-t and coverbeck October 20, 2023 00:33
Copy link
Contributor

@kathy-t kathy-t left a comment

Choose a reason for hiding this comment

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

Looks great!

@sonarcloud
Copy link

sonarcloud bot commented Oct 24, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

58.9% 58.9% Coverage
9.5% 9.5% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@svonworl svonworl merged commit 5f81733 into develop Oct 30, 2023
9 of 12 checks passed
@svonworl svonworl deleted the feature/dock-1195/add-archive-ui branch October 30, 2023 21:10
@svonworl svonworl mentioned this pull request Jan 12, 2024
11 tasks
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.

3 participants