-
Notifications
You must be signed in to change notification settings - Fork 512
Accessibility in the statistics table #3380
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
Closed
Andrea-Guevara
wants to merge
17
commits into
DSpace:main
from
Andrea-Guevara:AccessibilityInStatisticsTable
Closed
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
267bbd0
Accessibility in the statistics table - adding a dynamic label to the…
Andrea-Guevara 567dffa
back to the tags that were being used at first
Andrea-Guevara 6e47be7
New attempt -back to the tags that were being used at first
Andrea-Guevara 389d38d
Configuring e2e statistics tests to accept the td tag and adding test…
Andrea-Guevara cc7b272
Trying to solve the final spaces not allowed error
Andrea-Guevara 8b9d0e6
Trying to solve the final spaces not allowed error
Andrea-Guevara 9efa90f
Checking the collection-statistics.cy.ts test
Andrea-Guevara 941cb99
Back to the data-test statistics-label settings
Andrea-Guevara 8633d77
adjusting the file item-statistics.cy.ts
Andrea-Guevara 6b05354
Merge branch 'main' into AccessibilityInStatisticsTable
Andrea-Guevara 6bb1c50
Removing unauthorized spaces
796e0fc
Removing unauthorized spaces
4413fb5
Merge branch 'main' into AccessibilityInStatisticsTable
Andrea-Guevara cc4deaa
Merge branch 'main' into AccessibilityInStatisticsTable
Andrea-Guevara 0987607
Code refactoring
6c0a5a9
Removing tests that are no longer needed
2eb5052
Merge branch 'main' into AccessibilityInStatisticsTable
Andrea-Guevara 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -58,6 +58,11 @@ export class StatisticsTableComponent implements OnInit { | |
| */ | ||
| headers: string[]; | ||
|
|
||
| /** | ||
| * Object header label | ||
| */ | ||
| objectHeaderLabel: string; | ||
|
|
||
| constructor( | ||
| protected dsoService: DSpaceObjectDataService, | ||
| protected nameService: DSONameService, | ||
|
|
@@ -71,6 +76,7 @@ export class StatisticsTableComponent implements OnInit { | |
| if (this.hasData) { | ||
| this.headers = Object.keys(this.report.points[0].values); | ||
| } | ||
| this.objectHeaderLabel = this.getObjectHeaderLabel(this.report.reportType); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -91,4 +97,25 @@ export class StatisticsTableComponent implements OnInit { | |
| return of(point.label); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Defines a dynamic label for the object column | ||
| * @param reportType | ||
| */ | ||
| getObjectHeaderLabel(reportType: string): string { | ||
| switch (reportType) { | ||
| case 'TotalVisits': | ||
| return this.translateService.instant('statistics.table.header.TotalVisits'); | ||
|
||
| case 'TotalVisitsPerMonth': | ||
| return this.translateService.instant('statistics.table.header.TotalVisitsPerMonth'); | ||
| case 'TotalDownloads': | ||
| return this.translateService.instant('statistics.table.header.TotalDownloads'); | ||
| case 'TopCities': | ||
| return this.translateService.instant('statistics.table.header.TopCities'); | ||
| case 'topCountries': | ||
| return this.translateService.instant('statistics.table.header.topCountries'); | ||
| default: | ||
| return ''; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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 where your tests are failing. It looks like you previously were expecting
getObjectHeaderLabel()to return an empty string if you passed it an unrecognized type.This isn't going to work the same anymore, because you are always just returning
statistics.table.header.[type]in the code ingetObjectHeaderLabel(). So, I think you can just remove this test... all types will now be looked up in the i18n files. This seems appropriate though because it allows for adding new report types without having to modify your code.