-
Notifications
You must be signed in to change notification settings - Fork 96
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
Related Resources refactor and External Link scope
#327
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
922a2d1
Unscope RelatedResource from Sidebar
jeffdaley 2cc4945
Improvements to Link-scoped modal
jeffdaley 05240f2
Refactor Edit modal
jeffdaley 590a581
Add submit function to strict "Add" form
jeffdaley d61825a
Move types to shared component
jeffdaley e5d57e3
Improve validation
jeffdaley 4fce99f
Remove `pauseTest`
jeffdaley e30efd9
Remove redundant test
jeffdaley 75f08be
Remove empty state; Tests and fixes
jeffdaley 9306c39
Refactor Add/Edit modal
jeffdaley dedf7e8
Test selector cleanup
jeffdaley e8558fc
Cleanup
jeffdaley 23c2078
Remove comment
jeffdaley 925d7ed
Improve animation
jeffdaley d2b3399
Merge branch 'main' into jeffdaley/related-resources
jeffdaley f399aca
Remove unnecessary comment
jeffdaley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 56 additions & 59 deletions
115
web/app/components/document/sidebar/related-resources.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
<Document::Sidebar::SectionHeader | ||
{{did-insert (perform this.loadRelatedResources)}} | ||
@title={{@headerTitle}} | ||
@titleTooltipText={{this.titleTooltipText}} | ||
@badgeText="New" | ||
@buttonIsHidden={{this.sectionHeaderButtonIsHidden}} | ||
@buttonAction={{this.showAddResourceModal}} | ||
/> | ||
|
||
{{#if this.loadRelatedResources.isRunning}} | ||
<div class="h-[26px] pt-1.5"> | ||
<FlightIcon data-test-related-resources-list-loading-icon @name="loading" /> | ||
</div> | ||
{{else if this.loadingHasFailed}} | ||
<div class="h-16"> | ||
<div class="failed-to-load-text"> | ||
Failed to load | ||
</div> | ||
<Hds::Button | ||
data-test-related-resources-error-button | ||
@color="secondary" | ||
@size="small" | ||
@text="Retry" | ||
@icon="reload" | ||
{{on "click" (perform this.loadRelatedResources)}} | ||
<RelatedResources | ||
@items={{this.relatedResources}} | ||
@isLoading={{this.loadRelatedResources.isRunning}} | ||
@loadingHasFailed={{this.loadingHasFailed}} | ||
@modalHeaderTitle={{@modalHeaderTitle}} | ||
@modalInputPlaceholder={{@modalInputPlaceholder}} | ||
@addResource={{this.addResource}} | ||
@documentObjectID={{@objectID}} | ||
> | ||
<:header as |rr|> | ||
<Document::Sidebar::SectionHeader | ||
{{did-insert (perform this.loadRelatedResources)}} | ||
@title={{@headerTitle}} | ||
@titleTooltipText={{this.titleTooltipText}} | ||
@badgeText="New" | ||
@buttonIsHidden={{this.sectionHeaderButtonIsHidden}} | ||
@buttonAction={{rr.showModal}} | ||
/> | ||
</div> | ||
{{else}} | ||
<Document::Sidebar::RelatedResources::List | ||
@items={{this.relatedResources}} | ||
@itemLimit={{@itemLimit}} | ||
> | ||
<:resource as |r|> | ||
<Document::Sidebar::RelatedResources::ListItem | ||
@resource={{r}} | ||
@removeResource={{this.removeResource}} | ||
@editResource={{this.editResource}} | ||
@editingIsDisabled={{@editingIsDisabled}} | ||
</:header> | ||
<:list-loading> | ||
<div class="h-[26px] pt-1.5"> | ||
<FlightIcon | ||
data-test-related-resources-list-loading-icon | ||
@name="loading" | ||
/> | ||
</div> | ||
</:list-loading> | ||
<:list as |rr|> | ||
<Document::Sidebar::RelatedResources::List | ||
@items={{rr.items}} | ||
@itemLimit={{@itemLimit}} | ||
> | ||
<:resource as |r|> | ||
<Document::Sidebar::RelatedResources::ListItem | ||
@resource={{r}} | ||
@removeResource={{this.removeResource}} | ||
@editResource={{this.editResource}} | ||
@editingIsDisabled={{@editingIsDisabled}} | ||
/> | ||
</:resource> | ||
</Document::Sidebar::RelatedResources::List> | ||
</:list> | ||
<:list-error> | ||
<div class="h-16"> | ||
<div class="failed-to-load-text"> | ||
Failed to load | ||
</div> | ||
<Hds::Button | ||
data-test-related-resources-error-button | ||
@color="secondary" | ||
@size="small" | ||
@text="Retry" | ||
@icon="reload" | ||
{{on "click" (perform this.loadRelatedResources)}} | ||
/> | ||
</:resource> | ||
</Document::Sidebar::RelatedResources::List> | ||
{{/if}} | ||
|
||
{{#if this.addResourceModalIsShown}} | ||
<Document::Sidebar::RelatedResources::Add | ||
@headerTitle={{@modalHeaderTitle}} | ||
@inputPlaceholder={{@modalInputPlaceholder}} | ||
@onClose={{this.hideAddResourceModal}} | ||
@addResource={{this.addResource}} | ||
@algoliaResults={{this.algoliaResults}} | ||
@objectID={{@objectID}} | ||
@relatedDocuments={{this.relatedDocuments}} | ||
@relatedLinks={{this.relatedLinks}} | ||
@allowAddingExternalLinks={{@allowAddingExternalLinks}} | ||
@search={{perform this.search}} | ||
@getObject={{perform this.getObject}} | ||
@resetAlgoliaResults={{this.resetAlgoliaResults}} | ||
@searchErrorIsShown={{this.searchErrorIsShown}} | ||
@searchIsRunning={{this.search.isRunning}} | ||
/> | ||
{{/if}} | ||
</div> | ||
</:list-error> | ||
</RelatedResources> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now the default setting.