Skip to content

reverse-dependencies: Show "no results" message instead of empty list #3404

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

Merged
merged 1 commit into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/styles/crate/reverse-dependencies.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@
.rev-dep-downloads {
padding-left: 7px
}

.no-results {
text-align: center;
margin: 20px;
}
54 changes: 30 additions & 24 deletions app/templates/crate/reverse-dependencies.hbs
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
<CrateHeader @crate={{this.crate}} />

<div local-class="results-meta">
<ResultsCount
@start={{this.pagination.currentPageStart}}
@end={{this.pagination.currentPageEnd}}
@total={{this.totalItems}}
@name="reverse dependencies of {{this.crate.name}}"
/>
</div>
{{#if this.model}}
<div local-class="results-meta">
<ResultsCount
@start={{this.pagination.currentPageStart}}
@end={{this.pagination.currentPageEnd}}
@total={{this.totalItems}}
@name="reverse dependencies of {{this.crate.name}}"
/>
</div>

<div local-class="list" data-test-list>
{{#each this.model as |dependency index|}}
<div local-class="row" data-test-row={{index}}>
<div>
<LinkTo @route="crate" @model={{dependency.version.crateName}} data-test-crate-name>
{{dependency.version.crateName}}
</LinkTo>
requires {{dependency.req}}
<div local-class="list" data-test-list>
{{#each this.model as |dependency index|}}
<div local-class="row" data-test-row={{index}}>
<div>
<LinkTo @route="crate" @model={{dependency.version.crateName}} data-test-crate-name>
{{dependency.version.crateName}}
</LinkTo>
requires {{dependency.req}}
</div>
<div local-class="stats downloads">
{{svg-jar "download-arrow" local-class="download-icon"}}
<span local-class="rev-dep-downloads">{{ format-num dependency.downloads }}</span>
</div>
</div>
<div local-class="stats downloads">
{{svg-jar "download-arrow" local-class="download-icon"}}
<span local-class="rev-dep-downloads">{{ format-num dependency.downloads }}</span>
</div>
</div>
{{/each}}
</div>
{{/each}}
</div>

<Pagination @pagination={{this.pagination}} />
<Pagination @pagination={{this.pagination}} />
{{else}}
<div local-class="no-results">
This crate is not used as a dependency in any other crate on crates.io.
</div>
{{/if}}