-
Notifications
You must be signed in to change notification settings - Fork 420
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
Content reports ported from DSpace 6.x #1985
Conversation
Hi @jeffmorin, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
I rebased my branch and fixed the merge conflict. |
<tbody> | ||
<tr *ngFor="let coll of results.collections"> | ||
<td><a href="{{ coll.communityHandle }}" target="_blank">{{ coll.communityLabel }}</a></td> | ||
<td><a href="{{ coll.handle }}" target="_blank">{{ coll.label }}</a></td> |
Check warning
Code scanning / CodeQL
Potentially unsafe external link
</thead> | ||
<tbody> | ||
<tr *ngFor="let coll of results.collections"> | ||
<td><a href="{{ coll.communityHandle }}" target="_blank">{{ coll.communityLabel }}</a></td> |
Check warning
Code scanning / CodeQL
Potentially unsafe external link
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.
@jeffmorin : Good start here. I will admit, I have not done a thorough code review here yet, but I called out a few things that are failing in our GitHub CI checks & a few minor things to cleanup.
I did test this, and overall it seems to work. I'll admit though that I find the interface confusing to interact with (but it may be simply because I'm not as experienced with the older DSpace 6.x tool -- as I see this interface looks similar to that tool). I did find a few bugs though.
First, I noticed that, in the "Collection Filter Report", when you select a large number of filters (e.g. all of them), the results are very hard to read. Here's how they used to look in DSpace 6.x
However, here's how it looks in this PR:
I find this table view very difficult to read for a few reasons:
- The columns have no borders, making it hard to differentiate where one column ends and the other begins.
- The column headers are really long and wrap heavily (not sure how to get around this though)
- If you select more headers than can fit on a page, there's no way to scroll to the right. You'll notice the right-most column in the screenshot above has it's header cut off. There's no way to scroll right to see the rest of it, and all the other columns.
- There doesn't appear to be any way to paginate the results? Maybe I just don't have enough collections yet though... but I was surprised it shows everything on one page. That may not provide great performance if you have hundreds of collections.
A few other bugs:
- The links in this table are all broken. They appear to be trying to go to the handle, but the URL is incorrect. They probably should just link to the UUID of each object.
- When no results are returned on this page, the view looks confusing.
The same sorts of issues also exist in the Metadata Query Report. The tables are difficult to read as there's no column borders. I cannot scroll to the right, and pagination doesn't appear to work (at least for me it's always showing everything on page 1).
Overall, it is a good start...and it does behave similar to these tools in DSpace 6.x. I just think the UI needs some cleanup to make it easier to understand the results you are seeing.
Some more inline comments appear below regarding small things to clean up.
</thead> | ||
<tbody> | ||
<tr *ngFor="let coll of results.collections"> | ||
<td><a href="{{ coll.communityHandle }}" target="_blank">{{ coll.communityLabel }}</a></td> |
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.
There's a security alert on this line because you are using target="_blank"
without also specifying this attribute: rel="noopener noreferrer"
You should either add that attribute, or remove the target from this link. For more info, see https://cwe.mitre.org/data/definitions/1022.html
<tbody> | ||
<tr *ngFor="let coll of results.collections"> | ||
<td><a href="{{ coll.communityHandle }}" target="_blank">{{ coll.communityLabel }}</a></td> | ||
<td><a href="{{ coll.handle }}" target="_blank">{{ coll.label }}</a></td> |
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 line has the same security alert as the one above
@@ -0,0 +1,23 @@ | |||
import { Item } from "src/app/core/shared/item.model"; |
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 line has a lint failure (run yarn lint
locally to see it). We require single quotes in all import statements. So, change this to:
import { Item } from 'src/app/core/shared/item.model';
@@ -0,0 +1,108 @@ | |||
import { waitForAsync, ComponentFixture, TestBed} from '@angular/core/testing'; | |||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | |||
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; |
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 line has lint errors because you don't use TranslateService
in this spec. It can be removed from the import.
import { RawRestResponse } from 'src/app/core/dspace-rest/raw-rest-response.model'; | ||
import { CommunityDataService } from 'src/app/core/data/community-data.service'; | ||
import { ObjectCacheService } from 'src/app/core/cache/object-cache.service'; | ||
import { ActionsSubject, ReducerManager, ReducerManagerDispatcher, StateObservable, Store, StoreModule } from '@ngrx/store'; |
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 line has lint errors because you don't use ActionsSubject, ReducerManager, ReducerManagerDispatcher, StateObservable or Store in this spec. They should all be removed from this import
import { CollectionDataService } from 'src/app/core/data/collection-data.service'; | ||
import { MetadataSchemaDataService } from 'src/app/core/data/metadata-schema-data.service'; | ||
import { MetadataFieldDataService } from 'src/app/core/data/metadata-field-data.service'; | ||
import { StoreMock } from 'src/app/shared/testing/store.mock'; |
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.
StoreMock is also not used in this file. So it should be removed.
pageLimits: OptionVO[]; | ||
|
||
queryForm: FormGroup; | ||
currentPage: number = 0; |
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.
Because this is a simple integer, you can remove the type here. It should just be currentPage = 0;
Again, this error can be seen via yarn lint
query.predicates | ||
.map(qp => qp.toFormGroup(this.formBuilder)) | ||
.forEach(qp => this.addQueryPredicate(qp)); | ||
if (query.predicates.length == 0) { |
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 should be a triple equals (===
) instead of ==
. See https://howtodoinjava.com/typescript/equals-vs-strict-equals/
src/assets/i18n/ar.json5
Outdated
|
||
//"admin.reports.collections.title": "Collection Filter Report", |
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.
I've noticed that most of this PR is simply updates to every one of our language packs. You don't need to make these changes to every single language pack. You can just update en.json5
and that's OK (though you are welcome to edit others if you want). I just wanted to point this out though because it makes this PR look a lot larger than it really is & that might intimidate other code reviewers.
@@ -0,0 +1,36 @@ | |||
export class FilteredCollection { |
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.
Similar to Java, we require TypeDocs (similar to JavaDocs) to be added to all exported/public classes. If you could add them to all the new classes in this PR, that'd be appreciated (they don't need to be added to HTML or SCSS files...just the TS module files).
Hi @jeffmorin, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
References
Description
This pull request includes an initial version of the two content reports ported from DSpace 6.x.
Instructions for Reviewers
This pull request adds a Content Reports section in the Administration menu to provide access to both reports from the Angular web application.
After logging in using an account with administrator permissions, select the Report item from the Administration menu at the left of the page, then select one of the two entries in this section.
In the Filtered Items report, the Export Metadata functionality is not yet implemented, it will be part of another pull request, once this one is all settled and merged.
Please note:
filtered-collections-component.ts
andfiltered-items-component.ts
), I use a DSpaceRestService instance to send my requests to the REST layer. It may be better to create and use a specific data service similar toCollectionDataService
, but I will need help to do so if requested.filtered-items-component.spec.ts
run properly. I will definitely need help with this.Checklist
yarn run lint
[Not sure]package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.